04: Vertical Histogram
- View
- Total time limit:
- 1000ms
-
-
Describe
-
-
Enter 4 lines of all uppercase text, outputting a vertical histogram, giving the number of occurrences of each character. Note: Use only the number of occurrences of the output character, without the output of whitespace characters, numbers, or punctuation marks.
-
-
Input
-
The
-
input consists of 4 lines of uppercase text, with fewer than 80 characters on each line.
-
-
Output
-
The
-
output includes several lines. The last line gives 26 uppercase letters, separated by a space. The preceding lines include spaces and asterisks, and each letter appears several times, and an asterisk is output above the letter. Note: The first line of the output cannot be a blank line.
-
-
Sample input
-
-
The QUICK BROWN FOX JUMPED over the LAZY DOG. This is a EXAMPLE to TEST for Yourhistogram program. Hello!
-
-
Sample output
-
-
* * * * * * * * * * * ** * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *a B C D E F G H I J K L M
-
-
Source
-
-
translated from Usaco 2003 February Orange's question.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#include <iostream>#include<cstring>#include<cstdio>using namespacestd;inti,j,cs[ -],maxn,n=4;Chars[ -][35001],w[Bayi],b[ -][35001];intMain () { while(n--) {gets (w); for(i=0; I<strlen (w); + +i) {if(w[i]>= $&&w[i]<= -) {Cs[w[i]- $]++; MAXN=max (maxn,cs[w[i]- $]); } } } for(i=0;i< -;++i) { for(j=0; j<=maxn;++j) {if(j<=cs[i]) s[i][j]='*'; Elses[i][j]=' '; } } for(i=0;i< -;++i) { for(j=0; j<=maxn;++j) B[j][i]=S[i][j]; } for(i=maxn;i>=1;--i) { for(j=0;j< -;++j) cout<<b[i][j]<<" "; cout<<Endl; } for(i=0; i<= -;++i) cout<<Char(i+ $) <<" ";}
Openjudge 1.3-04 Vertical Histogram