summaryrefslogtreecommitdiff
path: root/one_word.c
diff options
context:
space:
mode:
Diffstat (limited to 'one_word.c')
-rw-r--r--one_word.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/one_word.c b/one_word.c
new file mode 100644
index 0000000..8d50542
--- /dev/null
+++ b/one_word.c
@@ -0,0 +1,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);
+ }
+ }
+}