Program / Task Name:

   Histogram

Level:

 

 Novice

Point Value:

 

 5

 

Task Description

A histogram is a bar graph in which the area of each bar is proportional to an item's frequency of occurrence.  Write a program to generate a histogram of the occurrences of the letters (A-Z) in a text file.

Program Input

A collection of strings. The input file prob05.in will not contain any blank lines.  All letters will be uppercase (no need to check), and your program may ignore numbers, spaces, punctuation, etc. Lines will be no longer than 80 characters, and if a letter occurs more than 32 times the histogram should stop at 32.

THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
THIS IS AN EXAMPLE OF HOW TO TEST YOUR
HISTOGRAM PROGRAM.  YOU
CAN USE THIS EXAMPLE.

Program Output

The program must display on screen a vertical histogram representing the occurrences of each letter of the alphabet:


                *
                *
      *         *
      *         *    *
  *   *         *   **
  *   *  *      *  ***
  *   *  **   * *  ****
  *   *  **   * ** ****
  *   * ***  ***** ****  **
  * * *****  ***** **** ***
  **************************
  ABCDEFGHIJKLMNOPQRSTUVWXYZ

 

   
  (c) 2004 Hewlett-Packard Company