#include<stdio.h>
/*打印输入中单词长度的直方图(水平)*/
main()
{
int c, i, nc, n;
nc = n = 0;//初始化赋初值
c = getchar();
while (c != EOF)//循环体输入
{
while (c == ' ' || c == '\t' || c == '\n')
c = getchar();//去除开始的空格
n++;
printf("%d:", n);//记单词的个数
while (c != '\n' && c != ' ' && c != '\t')
{
nc++;
c = getchar();
}//计算单词长度
for (i = 0; i < nc; i++)
printf("*");//输出长度直方
while (c == ' ' || c == '\t')
c = getchar();//跳过非字符输入
printf("\n");
nc = 0;//换行、单词长度计数清零
while (c == '\n')
{
c = getchar();
n = 0;
}//重新输入、计数及记单词数
}
}