https://pintia.cn/problem-sets/994805260223102976/problems/994805300404535296
#include<iostream>
#include <map>
using namespace std;
const int N = 1010;
char a[N];
map<char,int> m;
int main()
{
cin.getline(a,1005);
for(int i = 0; a[i]; i++)
m[a[i]]++;
for(auto x : m) cout << x.first << ":" << x.second << endl;
return 0;
}
原文:https://www.cnblogs.com/ApStar/p/13939306.html