# include<stdio.h>
# define NONBLANK 'a'
/*replace string of blanks with a single blank*/
main ()
{
    int c,lastc;
    lastc = NONBLANK;
    while((c = getchar())!=EOF)
    {
        if (c != ' ')
          putchar(c);
        if (c == ' ')
          if (lastc != ' ')
             putchar(c);
        lastc = c;
    }

}

 

posted on 2013-10-17 20:07  欧小弟  阅读(175)  评论(0编辑  收藏  举报