String Sort error

Hello Buddy please look in to my code and help/sort out my issue please
Ref:

the compare function is wrong
check both things, whether a is a substring of b
or whether b is a substring of a

if both of these are false then sort lexicographically

Hello Buddy, I didnt understand, please can you explain briefly about lexicographically because i didnt hear this, please help me

You should only return on the basis of length when one string is part of the other for example in case of Batman and Bat since Bat is prefix of Batman we will return using length but in case of Batman and Bat, we will not return using length because Bat is not prefix string in Bztman