Day 03
This commit is contained in:
12
day03/part2.py
Normal file
12
day03/part2.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
from itertools import chain, islice
|
||||
|
||||
lines = (x.strip() for x in open("input.txt"))
|
||||
s = 0
|
||||
|
||||
for line1, line2, line3 in (chain([first], islice(lines, 2)) for first in lines):
|
||||
i = set(line1).intersection(line2).intersection(line3)
|
||||
o = ord(i.pop())
|
||||
s += o - 0x60 if o > 0x60 else o - 38
|
||||
|
||||
print(s)
|
||||
Reference in New Issue
Block a user