Solve 2016 days 6 to 8.

This commit is contained in:
2024-03-29 09:19:48 -04:00
parent fe016c9a2f
commit 440ae63b31
4 changed files with 154 additions and 0 deletions

25
2016/d6.py Normal file
View File

@@ -0,0 +1,25 @@
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)