/*
* Exercise 1-12 Write a program that prints its input one word per line.
*
* fduan, Dec. 07, 2011
*/
#include <stdio.h>
#define IN 1
#define OUT 0
int main()
{
int c, state, nw;
state = OUT;
nw = 0;
while( ( c = getchar() ) != EOF )
{
if( c != ' ' && c != '\n' && c != '\t' )
{
state = IN;
putchar( c );
}
else if( state == IN )
{
state = OUT;
putchar( '\n' );
++nw;
}
}
printf( "Number of Words: %d\n", nw );
return 0;
}