initial commit on day 9
This commit is contained in:
commit
f896e7c753
31 changed files with 8328 additions and 0 deletions
13
6/1.py
Normal file
13
6/1.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
entry = set()
|
||||
total = 0
|
||||
with open("input") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
total += len(entry)
|
||||
entry = set()
|
||||
else:
|
||||
entry = set(line) | set(entry)
|
||||
total += len(entry)
|
||||
|
||||
print(total)
|
||||
19
6/2.py
Normal file
19
6/2.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
entry = set()
|
||||
total = 0
|
||||
new_group = True
|
||||
with open("input") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
total += len(entry)
|
||||
entry = set()
|
||||
new_group = True
|
||||
else:
|
||||
if new_group:
|
||||
new_group = False
|
||||
entry = set(line)
|
||||
else:
|
||||
entry = set(line) & entry
|
||||
total += len(entry)
|
||||
|
||||
print(total)
|
||||
15
6/einput
Normal file
15
6/einput
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
abc
|
||||
|
||||
a
|
||||
b
|
||||
c
|
||||
|
||||
ab
|
||||
ac
|
||||
|
||||
a
|
||||
a
|
||||
a
|
||||
a
|
||||
|
||||
b
|
||||
Loading…
Add table
Add a link
Reference in a new issue