#include #include<unordered_map> using namespace std; int main() { string str; getline(cin, str); char c; cin >> c; if(c >= 'a' && c <= 'z') c -= 32; int res = 0; unordered_map<char, int> m; for(int i=0; i<str.size(); i++) { if(str[i] >= 'a' && str[i] <= 'z') { //降为大写 str[i] -= 32; } m[str[i]]++; } for(auto it : m) { if(it.first == c) { res = it.second; break; } } cout << res << endl; return 0; }