c_exercises/1-12.c

21 lines
352 B
C
Raw Permalink Normal View History

2022-11-05 17:53:10 -03:00
#include <stdio.h>
#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */
int main(){
int c, state;
state = OUT;
while ((c = getchar()) != EOF) {
if (c == ' ' || c == '\n' || c == '\t'){
state = OUT;
putchar('\n');
}
else if (state == OUT) {
state = IN;
putchar(c);
}
}
return 0;
}