c_exercises/1-9.c

20 lines
274 B
C
Raw Normal View History

2022-11-05 17:52:07 -03:00
#include <stdio.h>
int main() {
int c;
int prevb = 0;
while ((c=getchar()) != EOF){
if (c == ' ' && prevb == 1){
continue;
}
if (c == ' '){
prevb = 1;
putchar(c);
}
else{
prevb = 0;
putchar(c);
}
}
return 0;
}