why this code gives wrong answer with inbuild sort function along with comparator
Regarding string sort
@mohitshendre2609 hey cause you are comparing strings purely on the basis of length, instead a lexographical comparision needs to be done
so it is not possible to solve this problem with inbuilt sort function and self made comparator
Only difference would be in case if the sorter string is present as prefix in longer string then put longer string before.