String sort problem

I am not able to get the larger string print before the smaller substring. Can you help me with the problem?

use this simple compare function

bool compare(string a, string b) {
	int i = 0;
	while (a[i] == b[i]) i++;
	if (a[i] == '\0')return false;
	else if (b[i] == '\0')return true;
	return a[i] < b[i];
}

i hope you understand the compare funciton
but if you have any doubt regarding this feel free to ask

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.