我的个人网站 Cheese的个人主页http://www.cheese.ren/
博客来源 PAT 乙级 1021 个位数统计-Cheese的个人博客PAT 乙级 1021 个位数统计http://blog.cheese.ren/41
欢迎交换友链 :-)
#include <bits/stdc++.h>
using namespace std;
int main() {
char str[1000];
while (cin >> str) {
int index[10]={0};
for (int i=0; i<strlen(str); i++)
index[str[i] - '0']++;
for (int i=0; i<10; i++)
if (index[i] != 0)
printf("%d:%d\n", i, index[i]);
memset(str, 0, 1000);
}
return 0;
}