题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
#include <cctype> #include <cstddef> #include <iostream> #include <bits/stdc++.h> #include <string> #include <unordered_map> using namespace std; int main() { string s; getline(cin, s); char c; cin>>c; unordered_map<char,size_t>mp; for(auto i:s){ ++mp[tolower(i)]; } cout<<mp[tolower(c)]; } // 64 位输出请用 printf("%lld")