import re
try:
    stack=[]
    str1=input()
    flag=input()
    for i in str1:
        stack.append(i.lower())
    
    print(stack.count(flag.lower()))

except:
    pass