aboutsummaryrefslogtreecommitdiff
path: root/1-12_one-word-per-line.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--1-12_one-word-per-line.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/1-12_one-word-per-line.c b/1-12_one-word-per-line.c
index 3f31d1d..29a38df 100644
--- a/1-12_one-word-per-line.c
+++ b/1-12_one-word-per-line.c
@@ -22,8 +22,10 @@ int main(void) {
nl++;
}
if (c == ' ' || c == '\n' || c == '\t') {
- state = OUT;
- putchar('\n');
+ if (state == IN) {
+ state = OUT;
+ putchar('\n');
+ }
} else if (state == OUT) {
state = IN;
nw++;