Skip to content

Instantly share code, notes, and snippets.

@kung-foo
Created December 6, 2020 06:45
Show Gist options
  • Save kung-foo/c6a37b0e9d5a1c564c559d49ec1e631b to your computer and use it in GitHub Desktop.
Save kung-foo/c6a37b0e9d5a1c564c559d49ec1e631b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
import sys
import random
src = open("input.txt", "r").readlines()
src = [r.strip() for r in src]
print(len(src))
groups = []
group = []
groups.append(group)
for row in src:
if row == "":
group = []
groups.append(group)
continue
group.append(row)
p1 = 0
p2 = 0
for g in groups:
a = set()
f = [set(x) for x in g]
p1 += len(set.union(*f))
p2 += len(set.intersection(*f))
print(p1)
print(p2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment