Every language provides some fuctions to do such things. See http://www.cplusplus.com/reference/string/string/insert/ for C++.
1 Like
What will you do in “AAABAAA”?
This wont work for the following case OHH
I solved it with O(N^2) per test case during the contest itself.
Here is my solution link
http://www.codechef.com/viewsolution/6562897
1 Like
you are correct my approach would give HOH .
but correct answer clearly seems to be HHO.
Hey can you please tell me why my solution is wrong.
This takes a lot less time and I have every test case I can think of but i am still getting the wrong answer.
Solution Link → CodeChef: Practical coding for everyone
can someone provide a test case ,where my code gives WA.
https://www.codechef.com/viewsolution/48036711
thanks in advance
Its shown an error on the while loop…