From 4b6ce825b8c63e1a9222bc7821906f4c2996b3ea Mon Sep 17 00:00:00 2001 From: celso Date: Sat, 5 Nov 2022 17:52:07 -0300 Subject: [PATCH] ninth exercise --- 1-9.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 1-9.c diff --git a/1-9.c b/1-9.c new file mode 100644 index 0000000..2e65dd1 --- /dev/null +++ b/1-9.c @@ -0,0 +1,19 @@ +#include +int main() { + int c; + int prevb = 0; + while ((c=getchar()) != EOF){ + if (c == ' ' && prevb == 1){ + continue; + } + if (c == ' '){ + prevb = 1; + putchar(c); + } + else{ + prevb = 0; + putchar(c); + } + } + return 0; +}