This commit is contained in:
2020-12-06 10:26:58 -05:00
parent c5c7f19d49
commit c1496e5e9e
4 changed files with 3058 additions and 0 deletions

41
6/6.py Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
import sys
L = []
with open(sys.argv[1], 'r') as f:
L = f.readlines()
L = [x.strip() for x in L]
# part 1
groups = [set()]
for i in L:
if i == '':
groups.append(set())
else:
for ii in i:
groups[-1].add(ii)
total = 0
for i in groups:
total += len(i)
print(total)
# part 1
groups = [{'people': 0}]
for i in L:
if i == '':
groups.append({'people': 0})
else:
groups[-1]['people'] += 1
for ii in i:
if ii not in groups[-1]:
groups[-1][ii] = 1
else:
groups[-1][ii] += 1
total = 0
for i in groups:
for ii in i:
if ii != 'people' and i[ii] == i['people']:
total += 1
print(total)

2198
6/input.txt Normal file

File diff suppressed because it is too large Load Diff