A programmer completes the user manual for a video game she has developed and realizes
she has reversed the roles of “goats” and “sheep” throughout the text.
Consider the programmer’s goal of changing all occurrences of “goats” to “sheep” and all
occurrences of “sheep” to “goats.” The programmer will use the fact that the word “foxes”
does not appear anywhere in the original text.
Which of the following algorithms can be used to accomplish this?