word1 = input() word2 = input() count = 0 for i in word1: if word2.lower() == i.lower(): count =count + 1 print(count)