2 taest cases are showing wrong answer ,, can you explain why


this is the code … its work fine for sample input, can you please explain my error

@Adi_choudhary
You need to print in lexographical order.
Test Case: abc
Expected Output:
acb
bac
bca
cab
cba
Your Output:
bac
bca
acb
cab
cba


here is modified code. i sorted the final answer lexiogrphically. but it still showing wrong answer in one test case.

@Adi_choudhary
The function compare had some error.


I had modified the code by using the inbuilt compare to and just printing in the base case.

If it helps please mark your doubt as resolved else if the doubt still exists,ask them freely here.We will be glad to help you.