Code not compiling

#include
#include
#include
using namespace std;

bool compare(string a,string b)
{
int i=0;
int j=0;
while(i<a.length() && j<b.length())
{
if(a[i]==b[j])
{
i++;
j++;
}
else
return a<b;
}
if(i==a.size())
return b>a;

if(j==b.size())
   return a>b;

}

int main()
{
int n;
cin>>n;
string *s=new string[n];
for(int i=0;i<n;i++)
cin>>s[i];
sort(s,s+n,compare);
for(int i=0;i<n;i++)
cout<<s[i]<<endl;
}

Hey, i have already shared the correct code on the other thread…

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.