Doubt in string sort problem

I am getting correct output for the provided test case but test case 1 is not getting passed. I want to know where I’m doing wrong.

you have made unnecessary additions to your code, the logic is if one string is prefix of other then you need to return opposite to the lexicographic order otherwise you have to return in lexicographic order.
Code

Oh okay…Thank you!

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.