Move all x at end problem

sir my code is passing all the cases but it does not work for two consecutive x’s. what changes can i do to make it work for two consecutive x’s?

Now it’s working https://ide.codingblocks.com/s/281721 for consecutive x case.