N = input()
K = input()

count = 0

for digit in N:
    if digit == K:
        count += 1

print(count)