l=[str(i) for i in input().split()]
s=l[0]
c=0
for i in range(0,len(s)):
    if(s[i]==l[1]):
        c=c+1
print(c)

f1e74e8e33061a44abbab3d95bef1c85c8761984
<mask token>

<mask token>
for i in range(0, len(s)):
    if s[i] == l[1]:
        c = c + 1
print(c)

l = [str(i) for i in input().split()]
s = l[0]
c = 0
for i in range(0, len(s)):
    if s[i] == l[1]:
        c = c + 1
print(c)

l=[str(i) for i in input().split()]
s=l[0]
c=0
for i in range(0,len(s)):
    if(s[i]==l[1]):
        c=c+1
print(c)
