tcpl 1-9

#习题1-9

##将输入中的连续多个空格替换为一个并输出

```

#include <stdio.h>

/* Run this program on itself (this file) and the following string "    "
  * will be only one blank long.
  */

main ()

{
     int    c;

    while ((c = getchar()) != EOF) {

        if (c == ' ') {

            putchar(' ');
             while ((c = getchar()) != EOF && c == ' ')

                ;

        }
         if (c != EOF)

            putchar(c);

    }
}

```

原文地址:https://www.cnblogs.com/impw/p/14015370.html