题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805300404535296
题解:
1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 int main(){ 6 string str; 7 cin >> str; 8 9 int temp[10] = { 0 }; 10 for (int i = 0; i < str.size(); i++) 11 temp[(str[i] - '0')]++; 12 for (int i = 0; i <10; i++){ 13 if (temp[i] == 0) continue; 14 else cout << i << ":" << temp[i] << endl; 15 } 16 return 0; 17 }