| ||||||||||
| 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 | |||||||||
Re:还行In Reply To:还行 Posted by:chenjiang at 2009-08-24 14:38:07 #include<iostream>
#include<string>
#include<map>
using namespace std;
int num[27];
int main()
{
char a_z[4][72];
int i;
for(i=0;i<4;i++)
gets(a_z[i]);
for(i=0;i<4;i++)
for(int j=0;j<strlen(a_z[i]);j++)
{
if(a_z[i][j] >= 'A' && a_z[i][j] <= 'Z')
num[a_z[i][j] - 'A']++;
}
int max=-1;
for(i=0;i<27;i++)
if(max < num[i])
max = num[i];
for(i=max;i>0;i--)
{
for(int k=0;k<27;k++)
if(num[k]<i)
cout<<" ";
else
cout<<"* ";
cout<<endl;
}
cout<<"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"<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator