aocpy/2020/d6.py
2024-08-30 22:59:22 -04:00

25 lines
406 B
Python

from lib import get_data
def part_1(data):
r1, r2 = 0, 0
for group in data.split("\n\n"):
r1 += len(set(group.replace("\n", "")))
s = set(group.splitlines()[0])
for line in group.splitlines():
s &= set(line)
r2 += len(s)
print(r1)
print(r2)
def main():
data = get_data(__file__)
part_1(data)
if __name__ == "__main__":
main()