Classwork 27: Blue Censor

Objectives

Practice working with string functions from various libraries.

The Assignment


Write a program that takes a line of text entered by the user and replaces every occurrence of the substring "blue" with the characters "@!#$". A sample run of your program might look like:

PT[115]% ./a.out
Enter a string: I tied a blue balloon to the blue smurf and he floated up to the blue sky.
Censored text: "I tied a @!#$ balloon to the @!#$ smurf and he floated up to the @!#$ sky."
PT[116]% 

Use functions from the string library to make this program simple.

Notes

Submit

Use the script command to record several sample runs of your program. Then, submit your program and sample run as usual:

submit cs104_chang cw27 censor.c
submit cs104_chang cw27 typescript