#include <stdio.h>
int main()
{
char n;
scanf("%c",&n);
int max=0;
int num[26]={0};
while(n)
{
if(n>='A'&&n<='z')
{
if(n>='a'&&n<='z')
{
num[n-'a']++;
if(num[n-'a']>max)
{
max=num[n-'a'];
}
}
else
{
num[n-'A']++;
if(num[n-'A']>max)
{
max=num[n-'A'];
}
}
}
else
{
scanf("%c",&n);
continue;
}
scanf("%c",&n);
}
char a[100][26]={'\0'};
int j=0;
int i=0;
while(j<26)
{
int k=num[i];
while(k>=0)
{
a[j][max-k]='*';
k--;
}
j++;
}
for(i=0;i<26;i++)
{
for (j=0;j<max;j++)
{
if(a[i][j]=='\0')
{
printf(" ");
}
else
{
printf("%c",a[i][j]);
}
}
}
printf("\n");
for(i=0;i<26;i++)
{
if(i==0)
{
printf("A");
}
else
{
printf(" %c",i+'A');
}
}
}
你要做的就是对一篇文章的字母进行统计。 而文章是由好多行字母,空格,标点组成的每行不会超过72个字符,请打印一个统计直方图来统计每个字母出现的次数 (不统计空行,数字,标点)。
Input
输入一份郑薇的甜言蜜语,只含有大小写字符,空格,标点。
Output
打印这一份甜蜜的统计图,具体如样例(最后不要空行)。
Sample Input
Amazing grace! How sweet the sound! That saved a wretch like me! I once was lost but now I am found, Was blind but now I see.
Sample Output
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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