s1 = input()
s2 = input().lower()
count = 0
for i in s1.lower():
    if i == s2:
        count += 1
print(count)