Sorting error string sort


please point out the mistakes!

Hello @varindavg,

Here’s what i have found:
Example:
4
batm
bat
apple
batman
Expected Output:
apple
batman
batm
bat
Your Output:
apple
batman
bat
batm

Example 2:
4
batman
batm
bat
apple
Expected Output:
apple
batman
batm
bat
Your Output:
apple
bat
batm
batman

Example3:
4
bat
apple
batman
batm
Expected Output:
apple
batman
batm
bat
Your Output:
apple
batm
batman
bat

Example 4:
4
bat
apple
batm
batman
Expected Output:
apple
batman
batm
bat
Your Output:
apple
batman
batm
bat
//Finally the correct output.

Figure out the common error in the above example and resolve it.

If you still face issue, let me know.
Hope, this would help.

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.