Can you tell why I am getting the wrong ans?

@akash_281 did you not see the output format? batman should come before bat but that is not the case in your code

I know but I am asking how to fix that?

@akash_281 in the compare function see if a is a subtring of b or not, and modify the comparison accordingly. You can use the string.find() function for that


Hey @Ishitagambhir I can pass one test case but not the other one can you see it once?

@akash_281 you are comparing the first character only, that wont always work. Use string.find() function to see if “a” is a substring of “b” or not.