Please enter your email address or userHandle.
Given three strings ‘str’, ‘oldW’ and ‘newW’. The task is find all occurrences of the word ‘oldW’ and replace then with word ‘newW’.
The first lne of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains 3 strings str, oldW and newW respectively.
Replace all the occurrences of oldW with newW in str.
1<=length of str<=1000
1<=length of oldW and newW<=length of str
xxforxx xx for xx
india is the xx country
geeksforgeeks geeks for geeks
india is the best country
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.