Bat should come before batman in lexographic order

In the given problem ,after sort bat is placed after batman,even though bat should come before batman

hi @divyanshinegi2003_987b3f0f92dd8c0c,

refer this ive commented https://ide.codingblocks.com/s/664987
it checks if a string is present completely as a prefix in another string, then string with longer length should come first