#include <ctype.h>
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    enum { SIZE = 256 };
 
    unsigned lengths[SIZE] = { 0 };
 
    int ch;
    unsigned word_length = 0;
    while ((ch = getchar()) != EOF)
    {
        if (!isalnum(ch))
        {
            if (word_length >= SIZE)
            {
                /* handle error */
            }
            else
                ++lengths[word_length];
 
            word_length = 0;
        }
        else
            ++word_length;
    }
 
    if (word_length)    /* handle case where EOF immediately follows a word */
    {
        if (word_length >= SIZE)
        {
            /* handle error */
        }
        ++lengths[word_length];
    }
 
    unsigned largest_count = 0;
    unsigned longest_index = 0;
    for (unsigned i = 0; i < SIZE; ++i)
    {
        if (lengths[i])
        {
            longest_index = i;
 
            if (largest_count < lengths[i])
                largest_count = lengths[i];
        }
    }
 
    const char* asterisks = "********************";
    size_t asterisks_length = strlen(asterisks);
    double ratio = ((double)asterisks_length) / longest_index;
 
    for (unsigned i = 1; i <= longest_index; ++i)
        printf("%3u:  %.*s\n", i, (unsigned)(ratio*lengths[i]), asterisks);
}