s=input() a=input() count=0 if a>='0' and a<='9': for w in s: if a==w: count+=1 else: for w in s: if a==w or a==w.swapcase(): count+=1 print(count)