added day 06
This commit is contained in:
parent
bd3ebf4e09
commit
8af76033f7
2178
06/input01.txt
Normal file
2178
06/input01.txt
Normal file
File diff suppressed because it is too large
Load Diff
15
06/input01_sample.txt
Normal file
15
06/input01_sample.txt
Normal file
@ -0,0 +1,15 @@
|
||||
abc
|
||||
|
||||
a
|
||||
b
|
||||
c
|
||||
|
||||
ab
|
||||
ac
|
||||
|
||||
a
|
||||
a
|
||||
a
|
||||
a
|
||||
|
||||
b
|
15
06/solve01.py
Normal file
15
06/solve01.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
ans_yes = 0
|
||||
with open("input01.txt","r") as f:
|
||||
answers = ""
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if len(line) == 0:
|
||||
ans_yes += len(set(answers))
|
||||
answers = ""
|
||||
continue
|
||||
answers += line
|
||||
|
||||
ans_yes += len(set(answers))
|
||||
print(ans_yes)
|
17
06/solve02.py
Normal file
17
06/solve02.py
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import string
|
||||
|
||||
ans_yes = 0
|
||||
with open("input01.txt","r") as f:
|
||||
answers = set(string.ascii_lowercase)
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if len(line) == 0:
|
||||
ans_yes += len(answers)
|
||||
answers = set(string.ascii_lowercase)
|
||||
continue
|
||||
answers = answers.intersection(set(line))
|
||||
|
||||
ans_yes += len(answers)
|
||||
print(ans_yes)
|
Loading…
x
Reference in New Issue
Block a user