This was already asked, but I made my own program and I don't know why it doesn't work.
int c;
char blank;
while ((c = getchar()) != EOF) {
    if (c == ' ') {
        putchar(c);
        while ((c = getchar()) == ' ') {
            putchar('');
        }
    }
    putchar(c);
}
Basically, replace space with nothing is what I did. But it doesn't work. If I put '1' instead of '' it replaces spaces with 1s so I don't know what's the problem
 
     
     
     
    