Day 6
This commit is contained in:
21
day06/part2.py
Normal file
21
day06/part2.py
Normal file
@@ -0,0 +1,21 @@
|
||||
lines = (set([c for c in x.strip()]) for x in open("input.txt"))
|
||||
|
||||
current = set()
|
||||
count = 0
|
||||
restart = True
|
||||
|
||||
|
||||
for line in lines:
|
||||
if len(line) == 0:
|
||||
count += len(current)
|
||||
current = set()
|
||||
restart = True
|
||||
continue
|
||||
if restart:
|
||||
current = line
|
||||
restart = False
|
||||
else:
|
||||
current = current.intersection(line)
|
||||
count += len(current)
|
||||
|
||||
print(count)
|
||||
Reference in New Issue
Block a user