Dictionary order doubt

what change should i make in my code
to print cab before cba

plzz suggest me the change

code—https://ide.codingblocks.com/s/99431

ques–
https://online.codingblocks.com/player/24179/content/4669/4895?tab=submissions

i modified my code
now 3 test cases are passed but the last one is failing
plzz tell me what i am still missing

@yatin hey yatin your code is fails to handle this case
231
your output is
312
321
but expected one is
321
312

i know this sir that this case is not able to pass
that why i am askling suggest me a change in my code

@yatin hey yatin this is right the approach codelink.

ooh
got it sir
in the similar ques sir
dictionary order smaller
https://online.codingblocks.com/player/24179/content/4669/4899
sir what is the ouput pattern
i am not getting
its not as in dictionary acb is before abc
not the reverse also because abc is before bca

plzz tell me what is the pattern of ans

@yatin hey yatin the funny thing is that the only change is that In compare function
a<b

@yatin I am talking about above code.

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.