int main(){
int i = 0;
int count = 0;
int gap= 'A'-'a';
char seq;
char a;
seq = (char)malloc(500*sizeof(char));
while((seq[i] = getchar()) != '\n'){
i++;
}
scanf("%c",&a);
printf("\n%d\n",i);
while(i--){
if(a == seq[i] || a == seq[i]+gap || a == seq[i]-gap){
count++;
}
}
printf("%d",count);
return 0;
}