// // Print the input one word per line // K&R Exercise 1-12. // #include #define WASSPACE 0 #define WASNOTSPACE 1 int main() { int c; int prev; prev = WASSPACE; while ( (c = getchar()) != EOF ) { if (c == ' ' || c == '\t' || c == '\n') { if (prev == WASNOTSPACE) { printf("\n"); prev = WASSPACE; } } else { printf("%c", c); prev = WASNOTSPACE; } } return 0; }