Unable to understand this logic

why false is return why not true. Please give illustration with eg

lets take the example given in video
apple bat batman

case 1 :
a.size() <= b.size() && b.substr( 0 , a.size()) == a return false

a = bat b = batman
clearly a is substring of b
so we need that batman comes first had we returned true then a would come before b
but we need b to be before a
so false is returned

b.size() <= a.size() and a.substr(0,b.size() ) == b return true

eg
a = batman and b = bat
b is substring of b ||
a need be to before b
hence true is returned

in case of anyother comparision
lexographic sort needs to be done
hence apple comes before any other element starting with b

But if i tried in many cases true is also working in each cases

when u pass true does it work

it would not be returning the desired results
like it would work
but not give correct answer

on same order it was coming as it required to come
i tried
apple bat batman
output : apple batman bat
code also successfully accepted

great if it got accepted bhaiya discussed the general way to approach this kind of sorting