I am not able to pass all the test cases
Sample Output
abc
acb
bac
bca
My output:
acb
abc
bca
bac
Not getting the right order
Hey friend, the order you are getting is of course not desired one. But the implementation is absolutely correct. There’s further more thing to do that is store your s string in a vector v then sort it using sort(v.begin(),v.end()) then you will see the vector will be having result in an desired output. You can ask again if you any doubt left