Exerpad
Exercise 3 · Chapter: String ManipulationRequired+50 XP

Find and Replace

Read a sentence, an old word, and a new word. Print the sentence with every occurrence of the old word replaced by the new word.

Example:

Input:

I like cats and cats like me
cats
dogs

Output:

I like dogs and dogs like me
Need a hint?
3 available · costs 5 XP each
javascript

Output
Run your code to see the output here.