string sort section the batman in expected output is before bat which is wrong as i think so can you explain the expected output…?
Expected output might be wrong
@sanyamsri2001
This has been explained in the problem statement itself. If there are two strings such that one is a prefix in another one then the one with larger length should come first.
Eg -
bat and batman.
Since bat is present as a prefix in batman , their comparison is done not by string comparison but by their lengths. Since batman has a larger length , it comes before bat even though the string comparison would have said otherwise.