Is there any other way other than this?

bool func(string &s1,string &s2){
if(s1[0]==s2[0])
return s1.length()>s2.length();
return s1<s2;
}

i guess this is incorrect to sort string you have to do like this:

bool func(string &s1,string &s2){
if(s1.length()==s2.length())
return s1<s2;
return s1.length()<s2.length();
}

I was asking this STRING SORT question in competitive section. I solved it but got curious for learning other way.

Mention problem link or screenshot or question.