5 lines
230 B
Python
5 lines
230 B
Python
with open("input.txt","r") as f:
|
|
groups = f.read().split('\n\n')
|
|
sets = [list(map(set, group.split('\n'))) for group in groups]
|
|
reduce = lambda fn: sum(len(fn(*s)) for s in sets)
|
|
print(reduce(set.union), reduce(set.intersection)) |