#B2135. Word Replacement in a Sentence

    ID: 11217 Type: Default 1000ms 256MiB

Word Replacement in a Sentence

Word Replacement in a Sentence

You are given a sentence composed of several words separated by a single space. The sentence's length is \( \leq 200 \). All words are case-sensitive. You are also provided with two additional words: the target word to be replaced and the replacement word. Your task is to replace every occurrence of the target word in the sentence with the replacement word and output the modified sentence.

Note: If the target word does not appear in the sentence, output the original sentence.

inputFormat

The input consists of three lines:

  • The first line contains the sentence (with words separated by a single space, and the length \( \leq 200 \)).
  • The second line contains the target word that needs to be replaced.
  • The third line contains the replacement word.

outputFormat

Output the sentence after replacing every occurrence of the target word with the replacement word.

sample

Hello world
world
everyone
Hello everyone