Cant be able to solve properly

can u please explain me this problem like how can i solve laxographically

Okay i will try to explain the question what it actually means
You are given three strings:
bat
apple
batman

Now you have to arrange it right? so you will see a is coming forward so yes

apple came

after that(you have to handle this with a comparator function)

bat is shorter then batman 
so it should have come before batman 
but here is the twist

When you get two strings such that one string can come under another string like bat came in batman. In this case we will print batman first and then bat.
So expected output is:

apple
batman
bat

but how to write its code


Here’s the 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.