Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank.

#include <stdio.h>
void main()
{
    int c,c_BCN;
    while((c=getchar())!=EOF)
    {
        if(c!=' ')
          c_BCN=0;
        if(c==' ')
            ++c_BCN;
        if(c_BCN<=1)
              putchar(c);                
    }
    printf("
%d
",c);
}
df  ff   f f fff    d fg   fgg
df ff f f fff d fg fgg
原文地址:https://www.cnblogs.com/wjshan0808/p/3326685.html