28 lines
688 B
Python
28 lines
688 B
Python
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))
|