/*state代表是否在单词中的状态*/
while((c = getchar()) != EOF)
{
if(c == ' ' || c == '\n' || c == '\t')
{
if(state == IN) //finish the word
putchar('\n');
state = OUT;
}
else if(state == OUT)
{
state = IN; //beginning of word
putchar(c);
}
else //inside a word
putchar(c);
}