Could u tell mitake in my logic i am not getting correct output

Hey @anantgovil123
Lets do dry run on
axxb
For i==0 its a move ahead (axxb)
For i==1 its x swap with i+1 char i.e x and move ahead(axxb)
for i==2 its again x so we swap with i+1 and move ahead (axbx)
for i==3 its agian x so we swap wit i+1 and move ahead (axb’\0’x)

See how u are going wrong

Now correct soln take 3 args string,start and end (str,0,len-1)
Whenever x comes swap a[start] and a[end] and do end–,dont move start because u dont know it coming char is x or not

So algo is

ss(str , start,end)
       if(start==end) return 
       if(str[start]=='x')
                swap(str[start],str[end])
                return ss(str,start,end-1)
       else return ss(str,start+1,end)