#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
int times = 0;
char a[1000] = {0};
char b[2] = {0};
gets(a);
scanf("%s",b);
int i;
for(i=0;i < strlen(a);i++){
if(b[0] >= 65){
if(a[i] == b[0] || a[i] == (b[0]+32) || a[i] == (b[0]-32)){
times++;
}
}else{
if(a[i] == b[0]){
times++;
}
}
}
printf("%d\n",times);
return 0;
}
#include <string.h>
#include <stdlib.h>
int main(){
int times = 0;
char a[1000] = {0};
char b[2] = {0};
gets(a);
scanf("%s",b);
int i;
for(i=0;i < strlen(a);i++){
if(b[0] >= 65){
if(a[i] == b[0] || a[i] == (b[0]+32) || a[i] == (b[0]-32)){
times++;
}
}else{
if(a[i] == b[0]){
times++;
}
}
}
printf("%d\n",times);
return 0;
}