https://www.codechef.com/viewsolution/33522399
what am I doing wrong?
We’ll need a link to your submission if you want us to answer that.
Sorry about that… Please check it now.
So i tried your code with this test case
4
cdba
aabb
Your output was
2
2 2 3
3 0 1 2
this means that, according to your code, you are going from cdba to cdbb
and then from cdbb to bbbb.
bbbb is different from the required string B (aabb) and that is why you are getting WA.
Please note that the operations are not performed on the original string but rather on the result of the previous operation.
Okay, thanks man . Now I got why I was getting WA, I forgot brackets after the if() int the first loop.
Now the answer is accepted.