Why is it not working?
Your replace function is not working … plz use some other approach for it
@sanjeetboora Pls look into this problem. As I have tested his code. The control is not even going into the function replace.The line cin>>str itself is not working
while(t–){
string str;
cout<<“hi”;
cin>>str;
str=replace(str);
cout<<str<<endl;
}
The above loop prints just one “hi” even though we have 3 test cases.
If you print something after cin>>str nothing is displayed
Please observe your approach carefully, in this problem you are calling the replace function like this
string result=replace(str,idx+1); but when you got "pi", then you are supposed to call the function after 2 indexes.