21 lines
371 B
Python
21 lines
371 B
Python
lines = (set(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
|
|
elif restart:
|
|
current = line
|
|
restart = False
|
|
else:
|
|
current = current.intersection(line)
|
|
count += len(current)
|
|
|
|
print(count)
|