#include <stdio.h>
#include <stdbool.h> /* C99, but a good idea to use nonetheless */

int main() {
    bool was_space; /* state variable */
    char c; /* one-character buffer */

    while ( ( c = getchar() ) != EOF ) {
        if ( ! was_space || c != ' ' ) putchar( c );
        was_space = c == ' ';
    }
    return 0;
}
