twelfth exercise

This commit is contained in:
celso 2022-11-05 17:53:10 -03:00
parent 5270971ad6
commit dc252d40ff
1 changed files with 20 additions and 0 deletions

20
1-12.c Normal file
View File

@ -0,0 +1,20 @@
#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;
}