2020/Day 6/two.py

21 lines
436 B
Python
Raw Normal View History

2022-07-01 15:56:12 +02:00
#!/bin/python
ALL_ANSWERS = set([i for i in "abcdefghijklmnopqrstuvwxyz"])
with open("input", "r") as input:
sum = 0
answers = set(ALL_ANSWERS)
for line in input:
line = line.strip()
if line == "":
sum += len(answers)
answers = set(ALL_ANSWERS)
continue
answers = answers.intersection(set([char for char in line]))
sum += len(answers)
print(sum)