#include <iostream>
#include <cstring>
using namespace std;
int main() {
char s[100],c;
cin.getline(s,100);
cin>>c;
int k=0, i=0;
while(s[i]!='\0'){
if(s[i]==c||s[i]==c-('a'-'A'))k++;
i++;
}
cout<<k;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgbWFpbigpIHsKCWNoYXIgc1sxMDBdLGM7CgljaW4uZ2V0bGluZShzLDEwMCk7CgljaW4+PmM7CgkKCWludCBrPTAsIGk9MDsKCXdoaWxlKHNbaV0hPSdcMCcpewoJCWlmKHNbaV09PWN8fHNbaV09PWMtKCdhJy0nQScpKWsrKzsKCQlpKys7Cgl9Cgljb3V0PDxrOwoJcmV0dXJuIDA7Cn0K