We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e5feae0 + 93bef39 commit 69f5fe4Copy full SHA for 69f5fe4
chapter_1/exercise_1_12/copy_io_nl.c
@@ -1,27 +1,20 @@
1
-#include <stdio.h>
2
-
3
-#define OUT 0
4
-#define IN 1
5
6
-int main(void)
7
-{
8
- char c;
9
- int state;
10
11
- state = OUT;
12
- while ((c = getchar()) != EOF)
13
- {
14
- if (c != ' ' && c != '\t' && c != '\n')
15
16
- putchar(c);
17
- state = IN;
18
- }
19
- else if (state)
20
21
- putchar('\n');
22
23
24
25
26
- return 0;
27
-}
+#include <stdio.h>
+
+int main(void)
+{
+ char c;
+ while ((c = getchar()) != EOF)
+ {
+ if (c == ' ' || c == '\t' || c == '\n')
+ putchar('\n');
+ }
+ else
+ putchar(c);
+ return 0;
+}
0 commit comments