C++简洁代码:
#include<bits/stdc++.h> using namespace std; int main() { string str; cin >> str; char ch; cin >> ch; unordered_map<char, int> map; for(char c : str) map[tolower(c)] ++; cout << map[ch]; return 0; }
C++简洁代码:
#include<bits/stdc++.h> using namespace std; int main() { string str; cin >> str; char ch; cin >> ch; unordered_map<char, int> map; for(char c : str) map[tolower(c)] ++; cout << map[ch]; return 0; }