Created
December 6, 2020 06:14
-
-
Save ShaswatPrabhat/09ee916aa756c4a9fa364658e8ab732f to your computer and use it in GitHub Desktop.
Day 6 solution for AOC 20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
answers = open('input_test.txt').read().replace('\r\n', '\n').replace('\n\n', '|').replace('\n', ' ').split('|') | |
part1 = 0 | |
part2 = 0 | |
for answer in answers: | |
part1 += len(set(answer.replace(' ', ''))) | |
part2 += len(set.intersection(*map(set, answer.split()))) | |
print(answer, '--->', list(map(set, answer.split()))) | |
print(f'Part 1: {part1}, Part 2: {part2}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment