advent/2016/06.py

15 lines
271 B
Python
Raw Normal View History

2017-01-14 00:34:25 +00:00
# Python!
import collections
with open('06.txt') as file:
rows = file.read().splitlines()
message = ''
for col in zip(*rows):
counts = collections.defaultdict(int)
for char in col:
counts[char] += 1
message += min(counts, key=lambda x: counts[x])
print(message)