43 lines
765 B
Python
43 lines
765 B
Python
#!/usr/bin/env python
|
|
total = 0
|
|
|
|
with open("inputd5.txt", "r") as f:
|
|
for line in f:
|
|
vowels = 0
|
|
previous_letter = ""
|
|
double_letter = False
|
|
|
|
for c in line:
|
|
naughty = False
|
|
|
|
if c in ["a", "e", "i", "o", "u"]:
|
|
vowels += 1
|
|
|
|
if c == previous_letter:
|
|
double_letter = True
|
|
|
|
if (previous_letter == "a" and c == "b"):
|
|
naughty = True
|
|
|
|
if (previous_letter == "c" and c == "d"):
|
|
naughty = True
|
|
|
|
if (previous_letter == "p" and c == "q"):
|
|
naughty = True
|
|
|
|
if (previous_letter == "x" and c == "y"):
|
|
naughty = True
|
|
|
|
if (naughty):
|
|
break
|
|
|
|
previous_letter = c
|
|
|
|
if (naughty == False and vowels >= 3 and double_letter == True):
|
|
total += 1
|
|
|
|
double_letter = False
|
|
previous_letter = ""
|
|
vowels = 0
|
|
|
|
print(total)
|