#include <stdio.h> int main() { int c; int flag = 0; while((c = getchar()) != EOF) { if(c == ' ') { if(flag == 0) { flag = 1; putchar(c); } } else if(c != ' ') { putchar(c); flag = 0; } } return 0; }
多个空格变为一个空格。