Help me with the logic pls

How to check whether a string is a substring of another string in the comparator function?

hello @Senjuti256
i think u want to check for prefix right?

use inbuilt find function to find position of smaller string in bigger string.

if it comes out to be 0 . that means smaller string is prefix of biggr string

as per this question we are asked to sort the strings in a way such that if a string is a substring of another string then it should come later.So i want to know the logic to check whether a string is present as a substring in another string.

u need to check for prefix.

image

this will work ->