2020-12-06 20:08:50 +00:00
|
|
|
with open("input.txt","r") as f:
|
|
|
|
groups = f.read().split('\n\n')
|
|
|
|
print(
|
|
|
|
(
|
2020-12-06 22:00:49 +00:00
|
|
|
sum(len(set.union(*map(set, group.splitlines()))) for group in groups), # you can just call set() directly on string, no need to call list()
|
|
|
|
sum(len(set.intersection(*map(set, group.splitlines()))) for group in groups)
|
2020-12-06 20:08:50 +00:00
|
|
|
)
|
|
|
|
)
|