The British and American Style of Spelling

  • + 0 comments

    Is this considered metaprogramming?

    import re
    
    n = int(input())
    text = '\n'.join([input() for _ in range(n)])
       
    t = int(input())
    for _ in range(t):
        word = input()
        word_uk = word.replace('ze', 'se')
        pattern = f'({word}|{word_uk})'
        print(len(re.findall(pattern, text)))