diff options
author | sinanmohd <pcmsinan@gmail.com> | 2022-06-04 12:11:15 +0530 |
---|---|---|
committer | sinanmohd <pcmsinan@gmail.com> | 2022-06-04 12:11:15 +0530 |
commit | c24973af02bc33f2f5f25d37e22ca91da5de3c47 (patch) | |
tree | 460a005b6a3a9a967bd881bc2bf01e0becbe33cc /1.18.c |
inital commit
Diffstat (limited to '1.18.c')
-rw-r--r-- | 1.18.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#include <stdio.h> + +#define MAXLINE 1000 + +int +main(void) +{ + int input, i, non_blank; + char str[MAXLINE]; + + i = 0; + non_blank = -1; + + while ((input = getchar()) != EOF) { + while (input != '\n' && input != EOF) { + str[i] = input; + + if (input != ' ' && input != '\t') + non_blank = i; + + ++i; + input = getchar(); + } + + if (non_blank == -1) + continue; + + str[non_blank+1] = '\0'; + printf("%s\n", str); + + i = 0; + } + + return 0; +} |