Files
aocpy/2016/d6.py
2024-03-29 09:19:48 -04:00

26 lines
487 B
Python

from lib import *
data = open(0).read().strip()
second = True
p = ""
for row in zip(*data.splitlines()):
counts = {}
for l in LETTERS_LOWER:
counts[l] = row.count(l)
maxc = 0
minc = 999
c = ""
for l, count in counts.items():
if second:
if count > 0 and count < minc:
minc = count
c = l
else:
if count > maxc:
maxc = count
c = l
p += c
print(p)