33 lines
619 B
Python
33 lines
619 B
Python
![]() |
#!/usr/bin/env python
|
||
|
|
||
|
def read_input():
|
||
|
with open('input.txt', 'r') as f:
|
||
|
for line in f:
|
||
|
yield line.strip()
|
||
|
|
||
|
def compare(a, b):
|
||
|
if len(a) != len(b):
|
||
|
return None
|
||
|
|
||
|
change = None
|
||
|
for i in range(len(a)):
|
||
|
if a[i] != b[i]:
|
||
|
if change is None:
|
||
|
change = i
|
||
|
else:
|
||
|
return None
|
||
|
return a[:change]+a[change+1:]
|
||
|
|
||
|
boxes = []
|
||
|
result = None
|
||
|
for box in read_input():
|
||
|
for b in boxes:
|
||
|
result = compare(box, b)
|
||
|
if result:
|
||
|
break
|
||
|
if result:
|
||
|
break
|
||
|
boxes.append(box)
|
||
|
|
||
|
print(result)
|