Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #define STR_LEN 100
- int main() {
- char s[STR_LEN], c;
- int i = 0, j;
- bool inword = false;
- while ((c = getchar()) != EOF) {
- if (c == ' ' || c == '\t') {
- if (inword) {
- inword = false;
- s[i++] = '\n';
- }
- }
- else {
- inword = true;
- s[i++] = c;
- }
- }
- for (j = 0; j < i; j++)
- putchar(s[j]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment