What is the problem in my code For String Sort

#include
#include
#include
#include
using namespace std;

bool compare(string a,string b)
{
if(a[0]==b[0])
{
if(a.length()<b.length())
{
if(a==b.substr(0,a.length()))
return 1;
else
return lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
}
else
{
if(b==a.substr(0,b.length()))
return -1;
else
return lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
}
}
else
{
return lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
}
}

int main()
{
int test;
cin>>test;
string s[test],buff;
getline(cin,buff);
for(int i=0;i<test;i++)
{
getline(cin,s[i]);
}
sort(s,s+test,compare);

for(int i=0;i<test;i++)
{
cout<<s[i]<<endl;
}
return 0;
}

Please Clear it fast

bool compare(string s1,string s2)
{
if(s1[0]==s2[0])
{
if(s1.size()>s2.size())
return true;
else
return false;
}
else
{
if(s1>s2)
return false;
else
return true;
}
}
USE THIS SORT FUNCTION
USE true and false instead of 0,1,-1 and ol
u can compare directly using >,<,== as lexographically order in string STL