From b30a821e7b8e646d2d041f83611fc40cccfe032f Mon Sep 17 00:00:00 2001 From: zlg Date: Wed, 13 Feb 2013 20:43:28 -0600 Subject: Fix 1-09's solution My initial solution tried to simplify the conditions for outputting a space. You really do need two 'if's in there. --- 1-09_single-spacing.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/1-09_single-spacing.c b/1-09_single-spacing.c index 82447ee..4bf802a 100644 --- a/1-09_single-spacing.c +++ b/1-09_single-spacing.c @@ -15,8 +15,10 @@ int main(void) { int spaces = 0; while ((c = getchar()) != EOF) { - if (c == ' ' && spaces == 0) { - putchar(c); + if (c == ' ') { + if (spaces == 0) { + putchar(c); + } spaces++; } else { putchar(c); -- cgit v1.2.3-54-g00ecf