String sort code

please help me out here

@WARHEAD hey neerav the problem with your code is that your strcmp will not work here instead you have to write a custom compare function try to make compare function if you unable to make that function do tag me I will help you out asap.

okay will let you know

this the code that i made please can you tell me how can i include the in which a string is present in the string and the string with larger length is to be printed first

@WARHEAD hey neerav use that code
bool compare(string a,string b)
{
if ( (a==b.substr(0,a.length())))
return b.length()>a.length();
else if((b==a.substr(0,b.length())))
return a.length()>b.length();

return a<b;
}

this is a new code please have a look

@WARHEAD why you’re creating your code so complex but you can solve this by a simple compare function all you need to do is that sort the array with custom compare function.

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.

Neerav, pls send me the last code you have wrote so that I could suggest you the changes in your code…

Since you arent replying anything, I am marking this doubt as resolved, You can reopen it if you face any doubt further…