String sort check prefix


is this good approach to check if one string is prefix of other or not?

@dhairya16
hello dhairya,
yeah for this problm it is correct approach