#K86397. Substring Replacement

    ID: 36855 Type: Default 1000ms 256MiB

Substring Replacement

Substring Replacement

You are given a string s along with two substrings: sub1 and sub2. Your task is to replace all occurrences of sub1 in s with sub2. This operation should mimic the behavior of the typical string replace function in many programming languages.

If sub1 does not appear in s, the string should remain unchanged. Consider edge cases like empty strings and replacing with an empty substring.

The replacement must be applied to every occurrence, and the result should be printed as a single line.

inputFormat

The input is given from stdin and consists of three lines:

  1. The first line is the original string s.
  2. The second line is the substring sub1 that needs to be replaced.
  3. The third line is the substring sub2 that will replace each occurrence of sub1 in s.

outputFormat

Output the modified string after replacing all occurrences of sub1 with sub2. The output should be printed to stdout as a single line.

## sample
Hello World
Hello
Goodbye
Goodbye World