String sort Problem

I’m unable to handle length part for bat and batman where bat is prefix of batman,i tried using mismatch but its not working.

@sounakume hey,don’t use mismatch function ,just apply brute force ,like check first string with next and compare them character by character for prefix and if one is prefix of other just swap them.hope this work for you.Feel free to ask any doubt.
Happy coding :slight_smile:

Thanks, I have solved it.