#include<iostream>
#include<algorithm>
#include<ccstring>
#include<string>
int main(){
string s;
char c;
getline(cin,s); //读入字符串
cin >> c; //读入字符
c = tolower(c); //将字符转换成其大写或小写
transform(s.begin(),s.end(),s.begin(),::tolower); //将字符串的大小写统一
int res = 0;
for(int i = 0;i<s.size();i++){
if(s[i] == c)res++;
}
printf("%d",res);
return 0;
}