I would like to write a program with getchar and putchar that read my input and prints one word per line and ignores all semicolon, comma , dot , newline, tab and space.
Here is my input:
"The Parsnip
The parnip, children, I repeat,
Is simply an anemic beet.
Some people call the parsnp edible;
Myself, I find this claim incredible."
#include<stdio.h>
int main()
{
int c;
while ((c = getchar()) != EOF)
{
if(c!=' ' && c!='\t' && c!='\n' && c!='.' && c!=',' && c!=';' )
putchar(c);
else
putchar('\n');
}
I would like to do something that my program prints world after each other in the newline, one word per each line without any space between words.
here is my output:I would like to remove space between words(empty lines).
Any suggestion or help s highly appreciated.
The
Parsnip
The
parnip
children
I
repeat
Is
simply
an
anemic
beet
Some
people
call
the
parsnp
edible
Myself
I
find
this
claim
incredible