c

#include <stdio.h>

int main(void)
{
    char str[1000] = {0}, ch = 0;
    fgets(str, sizeof(str), stdin);
    ch = getchar();//fgetc(stdin);

    int str_len = strlen(str) - 1;
    if (str_len == 0) {
        printf("0\n");
        return 0;
    }

    int count = 0, i = 0;
    if (ch >= 'A' && ch <= 'Z') {
        for (i = 0; i < str_len; i++) {
            if (str[i] == ch || str[i] == ch+32)
                count++;
        }
    } else if (ch >= 'a' && ch <= 'z') {
        for (i = 0; i < str_len; i++) {
            if (str[i] == ch || str[i] == ch-32)
                count++;
        }
    } else {
        for (i = 0; i < str_len; i++) {
            if (str[i] == ch)
                count++;
        }
    }

    printf("%d\n", count);
    return 0;
}