Recursion dictionary order Larger

My code is giving correct output for sample test case provided in the question. But on submitting the solution, no test case is passing. Can you please check?

@Samarth_Shah output is not in sorted order

Any simple way to give a sorted output?

@Samarth_Shah put all the strings in a set. Print the set, the values will be present in a sorted order

@Ishitagambhir can given an example of what output is sorted
i have this input = “abc”
and i getting
acb
bac
bca
cab
cba

@Vikaspal Sorted means in dictionary order

@Ishitagambhir output is same in both the case but how to different when are not and sorted functions. It creating some confusion

@Vikaspal please be more clear, I’m unable to understand what you’re asking

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.