Advent-of-Code/2020/day 6/P2/custom_customs.py
2020-12-06 12:23:01 +01:00

13 lines
362 B
Python

qs = []
with open("input.txt") as f:
for q in f.read().split("\n\n"):
s = {}
q = list(filter(lambda x: x, q.split("\n")))
ln = len(q)
for a in q:
for le in list(a):
s[le] = s[le] + 1 if le in s else 1
qs.append(list(filter(lambda x: s[x] == ln, s)))
print(sum(map(lambda x: len(x), qs)))