| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
一次AC 爽啊 (代码) 爽啊
#include<stdio.h>
#include<string.h>
int main()
{ char a[300];int i,l,m,n,length,j=0,max=0,b[26];
for(l=0;l<26;l++)
b[l]=0;
while(scanf("%s",a)!=EOF)
{ length=strlen(a);
for(i=0;i<length;i++)
{ if(a[i]>='A'&&a[i]<='Z')
(b[a[i]-'A'])++;
}
} max=b[0];
for(m=0;m<26;m++)
if(b[m]>max)
max=b[m];
while(max)
{ for(n=0;n<26;n++)
{if(b[n]==max) {printf("*");
b[n]--;
if(n!=26) printf(" ");}
else {printf(" ");
if(n!=26) printf(" ");}
} printf("\n");
max--;
}
printf("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator