Encoders
>
More...
>
C
>
Program
/* Program to print a histogram of the lengths of words in its
input. */
#include <stdio.h>
#define IN 1
#define OUT 0
main()
{
int c, state=OUT,i=0;
while(c=getchar())
if(c!=' '&&c!='\t'&&c!='\n'&&c!=EOF)
{
state=IN;
putchar(c);
i++;
}
else if(state==IN)
{
state=OUT;
printf("\t\t");
for(;i>0;i--)
putchar(178);
printf("\n");
if(c==EOF)
break;
}
printf("\n");
}
|