#include<stdio.h>
#include<string.h>
int main()
{
char s[1001];
scanf("%s",&s);
int count[10] = { 0 };
int len = strlen(s);
for (int i = 0; i < len; i++)
{
if (s[i] == '0')
count[0]++;
if (s[i] == '1')
count[1]++;
if (s[i] == '2')
count[2]++;
if (s[i] == '3')
count[3]++;
if (s[i] == '4')
count[4]++;
if (s[i] == '5')
count[5]++;
if (s[i] == '6')
count[6]++;
if (s[i] == '7')
count[7]++;
if (s[i] == '8')
count[8]++;
if (s[i] == '9')
count[9]++;
}
for (int i = 0; i < 10; i++)
{
if (count[i] != 0)
{
printf("%d:%d\n", i, count[i]);
}
}
}
03-27
349
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-05
346
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)