twelfth exercise
This commit is contained in:
parent
5270971ad6
commit
dc252d40ff
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue