/*
 * Problem 1-13
 * Write a program to print a histogram of the lengths of 
 * the words in its input.
 * Copyright (c) 1998 by John Weber.  All rights reserved.
 */
#include <stdio.h>

int main(void)
{
	int character;
	int count;
	int word_counts[256];
	int word_count;
	int word_length;

	word_count = 0;
	word_length = 0;
	for(count = 0; count < 256; count++) word_counts[count] = 0;

	while( (character = getchar()) != EOF ) {
		if( character == ' ' || character == '\n' || character == '\t' ) {
			word_counts[word_length]++;
			word_length = 0;
		} else {
			word_length++;
		}
	}

	printf("Word Length Histogram\n");
	for( character = 0; character < 256; character++ ) {
		printf("[%d] ",character);
		for( count = 0; count < word_counts[character]; count++ ) printf("#");
		printf("\n"); 
	}

	return 0;
}
