String Sort code problem

Why what can I improve iin my code to print as desired as my every attempt to print it according to problem failed

link to my code :https://pastebin.com/CqTvybdf

@Divya_321 there are some errors in your compare function, when lengths are unequal it is sorting according to the lengths, in decreasing order, and when lengths are equal the function is giving ambiguous results. So I wrote another compare function for you, it does not use the mismatch method, rather it manually checks for each character of 2 strings. Here is the function


Hope this helps.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

if(index>=min)
return s1.length()>s2.length();

may you give me a case in which index > min , as far as it seems to me only == will work

You are right, it will only worked with ==, I have solved a lot problems where you have to deal with the cases of >=, so I wrote that in a flow here.
I apologize for my mistake.