import sys strs = input() char = input() count = 0 for str in strs: if char.upper() == str or char.lower() == str: count += 1 print(count)