Failing at a test case
Here’s the code
#include
#include
#include
#include
using namespace std;
bool compare(string c,string d)
{
string ab=c+d;
string ba=d+c;
return ab.compare(ba)>0;
}
int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
string s[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];
}
cout<<endl;
return 0;
}