Move All X at End Problem

Though i wrote the correct code. But i’m unable to understand, why this one is wrong. Please explain me, where is the mistake.

make the loop till cnt-1

//print the string in which all Xs are at the end
        for(int i=0; i<cnt-1; i++){
            cout<<'x';
        }

still debug your code for abbxbbxee

It is giving wrong output for abbxbbxee after making the loop till cnt-1

…

check now

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.