The British and American Style of Spelling

  • + 0 comments

    for begginers python

    # Enter your c
    import re
    st = ""
    for i in range(int(input())) :
        st += (" "+input())
        
    for t in range(int(input())) :
        c = 0
        word1 = input()
        word2 = word1[:len(word1)-2]+"se"
        c += len(list(re.findall(word1,st)))
        c += len(list(re.findall(word2,st)))
        
        print(c)