2020/Day 6/two.py

21 lines
436 B
Python
Executable File

#!/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)