Form biggest number

please check my code

#include
#include
using namespace std;

bool compare(string a,string b){
if (a==b){
return a<b;
}
else {
return a>b;
}
}

int main (){

int times;
cin>>times;
for (int i=0;i<times;i++){
	int n;
    cin>>n;
    cin.get();

    string s[1000];

    for (int i=0;i<n;i++){
        getline(cin,s[i],' ');
    }
    s[i]='\0';
    
    
    sort(s,s+n,compare);
    for (int i=0;i<=n;i++){
        cout<<s[i];
    }
}

}

instead of comparing a with b, you have to compare a+b with b+a.