16 lines
495 B
Python
16 lines
495 B
Python
|
with open("6.txt") as f:
|
||
|
data = f.read().split("\n\n")
|
||
|
def process(lines):
|
||
|
return len(set("".join(lines.split("\n"))))
|
||
|
print(sum(map(process, data)))
|
||
|
|
||
|
from functools import reduce
|
||
|
with open("6.txt") as f:
|
||
|
data = f.read().split("\n\n")
|
||
|
def process(lines):
|
||
|
lines = lines.strip()
|
||
|
letters = reduce(set.intersection, map(set, map(list, lines.split("\n"))))
|
||
|
print(repr(lines), letters)
|
||
|
return len(letters)
|
||
|
print(sum(map(process, data)))
|