Cannot find a logic

I cannot find a logic for the myCompare( ) function in String Sort problem.

You can see my Implementation.
If you still got any doubt , feel free to ping me.