Move all x to the end

i am not able to swap the element when there is x at the end of the string