1
0
Fork 0
aoc2022/03/solution.py

11 lines
361 B
Python
Executable File

#!/usr/bin/env python3
import sys
S = G = 0
for l in zip(*[iter(list(map(lambda c: c - ord('A') + 27 if c < ord('a') else c - ord('a') + 1, map(ord, x.strip()))) for x in sys.stdin)] * 3):
G += set.intersection(*map(set, l)).pop()
S += sum(set(x[:int(len(x) / 2)]).intersection(x[int(len(x) / 2):]).pop() for x in l)
print(f"Silver: {S}\nGold: {G}")