s = input().strip()
c = input().strip()
count = 0
if c.isalpha():
# 统计大小写形态的总次数
lower_c = c.lower()
upper_c = c.upper()
count = s.count(lower_c) + s.count(upper_c)
elif c.isdigit():
# 统计数字的出现次数
count = s.count(c)
print(count)

京公网安备 11010502036488号