Testcase 4 is failing

Why are all other test cases passing and only the 4th fails? I have checked the order of my output too. Used ordered set.

Mitaali , plz share your code by saving on ide, so that I could check it.

Sure, this is the link. https://ide.codingblocks.com/s/108472

Mitali, your code is not producing correct output in sample test case.
Input : cab
Expected Output : cba
Your output :
acb
bac
bca
cab
cba

You can simply follow the approach, by using the permutations that the input produces, but before printing all combinations, you need to write a myCompare function which can sort them in the correct order.

That was the incorrect code, sorry my bad.
The corrected code is-

This code is not not producing any output. Plz send corrected code, or else I will suggest the changes in the previous code you have sent.

Mam, the same code is giving me the correct output except that one test case.
https://ide.codingblocks.com/s/110455
I’ll attach the screenshot too.

Your code is not producing correct output for :
231
Expected Output :
321
312
Your output :
312
321

Try to modify the code…