#advent of code 2020 #day 06 PuzzleInput = open("06.in","r").read(); groups = PuzzleInput.split("\n\n"); p1 = 0; p2 = 0; for group in groups: anyone = group.replace("\n",""); p1 += len(set(list(anyone))); everyone = group.split("\n"); answers = []; for e in everyone: if len(e) == 0: continue; #some minor adjustment bc parsing answers.append(set(list(e))) total = answers[0]; #answers of the first guy (1st line) for a in answers[1:]: total = total.intersection(a); #shrink the set to duplicates only p2 += len(total); print("part 1 =",p1); print("part 2 =",p2);