import sys

string = input()
char  = input()

count = 0
for ch in string:
    if ch.lower() == char.lower():
        count += 1

print(count)