1
0
Fork 0
aoc2022/03/solution.py

11 lines
326 B
Python
Raw Normal View History

2022-12-03 12:21:26 +01:00
#!/usr/bin/env python3
import sys
S = G = 0
2022-12-04 00:35:13 +01:00
for l in zip(*[iter(list(map(lambda c: c - 38 if c < 97 else c - 96, map(ord, x.strip()))) for x in sys.stdin)] * 3):
2022-12-03 12:21:26 +01:00
G += set.intersection(*map(set, l)).pop()
2022-12-04 00:35:13 +01:00
S += sum(set(x[:len(x) // 2]).intersection(x[len(x) // 2:]).pop() for x in l)
2022-12-03 12:21:26 +01:00
print(f"Silver: {S}\nGold: {G}")