#include <stdio.h>
#include <string.h>
int char_int(char* a, int point)
{
return (int)(*(a+point) - '0');
}
void Print_Array(int a[],int len)
{
int i ;
for(i = 0; i < len; i ++)
{
printf("%d ",a[i]);
}
}
int main()
{
char c_num[1001];
scanf("%s",c_num);
int i_num[1001];
int i;
for(i = 0; i < strlen(c_num); i ++)
{
i_num[i] = char_int(c_num,i);
}
int flag[10] = {0};
for(i = 0; i < strlen(c_num); i ++)
{
switch (i_num[i])
{
case 0:flag[0]++;break;
case 1:flag[1]++;break;
case 2:flag[2]++;break;
case 3:flag[3]++;break;
case 4:flag[4]++;break;
case 5:flag[5]++;break;
case 6:flag[6]++;break;
case 7:flag[7]++;break;
case 8:flag[8]++;break;
case 9:flag[9]++;break;
default:
break;
}
}
int cout = 0;
for(i = 0 ;i < 10;i ++)
{
if(flag[i] != 0)
{
cout ++;
}
}
for(i = 0 ;i < 10;i ++)
{
if(flag[i] != 0)
{
printf("%d:%d",i,flag[i]);
if(cout != 0)
printf("\n");
cout --;
}
}
return 0;
}
|