C++ map
字符数量
https://ac.nowcoder.com/acm/problem/22225
#include <iostream>
#include <map>
using namespace std;
int main(){
string s;
map<char, int> mp;
while(getline(cin, s)){
for(const auto& x : s){
if(x >= 'a' && x <= 'z') ++mp[x];
}
}
for(const auto& x : mp){
cout << x.first << ':' << x.second << endl;
}
return 0;
}
查看17道真题和解析
