summaryrefslogtreecommitdiff
path: root/ch1/one_word.c
blob: 8d5054246cfc9408ade8e42658831ee4b83996d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>

/*
 * Print input one word per line.
 */
main() {
    int c;

    while ((c = getchar()) != EOF) {
        if (c == ' ' || c == '\n' || c == '\t')
            putchar('\n');
        else {
            putchar(c);
        }
    }
}