/*#include<iostream>
#include<math.h>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
int number ;
cin>>number;
int len=0;
int i;
int numberothername;
numberothername=number;
while(numberothername>0){
numberothername=numberothername/10;//cout<<numberothername;
len++;
}
int a[1000]={0};
if(len!=1)
{
for( i=1;i<len;i++){
int scout;
scout=number%10;//cout<<scout;
number=floor(number/10);
a[scout]++;//cout<<"a[scout]:"<<a[scout]<<" "<<scout<<endl;
//numberothername=floor(numberothername/pow(10,i+1));//cout<<"numberothername:"<<numberothername<<endl;
}
a[number]++;
for(int i=0;i<1000;i++){
if(a[i]!=0) {
cout<<i<<":"<<a[i]<<endl;
}
}
}
else if(len==1)
{
cout<<number<<":"<<1<<endl;
}
else if (number==0){
cout<<0<<":"<<0<<endl;
}
}*/
#include<stdio.h>
#include<string.h>
int main()
{
int i,k,j;
char s[1000];
int b[10];
for(i=0;i<10;i++)
{
b[i]=0;
}
scanf("%s",s);
for(j=0;j<10;j++)
{
for(k=0;k<strlen(s);k++)
{
if(s[k]-48==j){
b[j]++;
}
}
}
for(i=0;i<10;i++)
{
if(b[i]!=0)
{
printf("%d:%d\n",i,b[i]);
}
}
return 0;
}
PTA-VL1-003 个位数统计
最新推荐文章于 2024-08-16 23:08:36 发布