#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    char c;
    getline(cin, s);
    cin >> c;

    int result;
    if(isdigit(c) == 1){
        result = count(s.begin(), s.end(), c);
    }else {
        int a = count(s.begin(), s.end(), tolower(c)); 
        int b = count(s.begin(), s.end(), toupper(c));
        result = a + b;
    }

    cout << result << endl;
}
// 64 位输出请用 printf("%lld")
  1. 判断数字字母:isdigit()、isalpha(),用于分类讨论。
  2. 统计容器中的元素个数:count(),直接用于计算result。
  3. 转换大小写:tolower()、toupper(),直接用于计算字母的总数。