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
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.