summaryrefslogtreecommitdiffstats
path: root/5/1.py
diff options
context:
space:
mode:
Diffstat (limited to '5/1.py')
-rw-r--r--5/1.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/5/1.py b/5/1.py
new file mode 100644
index 0000000..8100d06
--- /dev/null
+++ b/5/1.py
@@ -0,0 +1,18 @@
+vowels = set("aeiou")
+bad = {('a', 'b'), ('c', 'd'), ('p', 'q'), ('x', 'y')}
+def check(w):
+ vcnt = 0
+ dbl = False
+ last = None
+ for c in w:
+ if c in vowels:
+ vcnt += 1
+ if not dbl and c == last:
+ dbl = True
+ if (last, c) in bad:
+ return False
+ last = c
+ if vcnt >= 3 and dbl:
+ return True
+ return False
+print(len([w for w in open('input') if check(w)]))