x1 = input() x2 = input() x3 = x1.upper() x4 = x2.upper() n = 0 for word in x3: if word == x4: n = n + 1 print(n)