summaryrefslogtreecommitdiffstats
path: root/5/1.py
blob: 8100d06e5229809f6e43d08210048a8d8741c46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)]))