Answer :
Here is a Python program:
tmp = input().split(' ')
c = tmp[0]; s = tmp[1]
ans=0
for i in range(len(s)):
if s[i] == c: ans+=1
# the ans variable stores the number of occurrences
print(ans)
tmp = input().split(' ')
c = tmp[0]; s = tmp[1]
ans=0
for i in range(len(s)):
if s[i] == c: ans+=1
# the ans variable stores the number of occurrences
print(ans)