import shared
import matrix
from collections import Counter
import numpy as np

letters = [x for x in 'abcdefghijklmnopqrstuvwxyz']
letter_doubles = [x+x for x in letters]
vowels = [x for x in 'aeiou']
no = ['ab','cd','pq','xy']

def check_pt1(s):
    any_no = [True for x in no if x in s]
    if any_no:
        return False

    vowel_count = 0
    for l in s:
        if l in vowels:
            vowel_count += 1
    if vowel_count < 3:
        return False

    for d in letter_doubles:
        if d in s:
            return True
    return False


def pt1(strs):
    okay = [s for s in strs if check_pt1(s)]
    print(len(okay))


def check_pt2(s):
    for idx in range(len(s)-1):
        me = s[idx:idx+2]
        index = s.rindex(me)
        if index and index != idx and index != idx+1:
            break
    else:
        return False
    for idx in range(len(s)-2):
        me = s[idx:idx+3]
        if me[0] == me[2]:
            return True
    return False

def pt2(strs):
    okay = [s for s in strs if check_pt2(s)]
    print(len(okay))

def main():
    with open(shared.get_fname(5), "r") as f:
        inp = [x.rstrip() for x in f.readlines()]
    pt1(inp)
    pt2(inp)

if __name__ == "__main__":
    main()
