Question: Write a C program called censored.c that takes any number of one-word text string arguments, each less than 128 characters long. Word is defined as
Write a C program called censored.c that takes any number of one-word text string arguments, each less than 128 characters long. "Word" is defined as in the previous task. The program copies text from stdin to stdout, except that any of the words seen in the input are replaced with the word "CENSORED". The argument and the input stream are both ASCII. The input to stdin is of any length.
Example:
$ cat poem.txt Said Hamlet to Ophelia, I'll draw a sketch of thee, What kind of pencil shall I use? 2B or not 2B? $ ./censor Ophelia < poem.txt Said Hamlet to CENSORED, I'll draw a sketch of thee, What kind of pencil shall I use? 2B or not 2B?
$ cat beatles.txt paul ringo george john $ ./censor paul ringo john < beatles.txt CENSORED CENSORED george CENSORED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
