Openjudge 1.3-04 Vertical Histogram

Source: Internet
Author: User

04: Vertical Histogram
    • View
    • Total time limit:
    • 1000ms
    • Memory Limit: 65536kB
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+ $) <<" ";}
    • Submit

Openjudge 1.3-04 Vertical Histogram

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.