first commit
This commit is contained in:
commit
31bda4481f
37 changed files with 4645 additions and 0 deletions
28
2015/five/solution.py
Normal file
28
2015/five/solution.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
vowels = ["a","e","i","o","u"]
|
||||
groups = ["ab", "pq", "cd", "xy"]
|
||||
with open("./input", "r") as file:
|
||||
strings = list(file.read().split("\n"))
|
||||
|
||||
niceStrings = []
|
||||
|
||||
for string in strings:
|
||||
n = 0
|
||||
dl = False
|
||||
notContains = True
|
||||
for character in list(string):
|
||||
if character in vowels:
|
||||
n += 1
|
||||
for i in range(len(string)-1):
|
||||
if list(string)[i] == list(string)[i+1]:
|
||||
dl = True
|
||||
break
|
||||
|
||||
for group in groups:
|
||||
if group in string:
|
||||
notContains = False
|
||||
break
|
||||
if n >= 3 and dl and notContains:
|
||||
niceStrings.append(string)
|
||||
print(string, n, dl, notContains)
|
||||
|
||||
print(len(niceStrings))
|
Loading…
Add table
Add a link
Reference in a new issue