Form biggest number

what is the problem with my code
it is giving right answer for my cases. which cases are giving wrong answer for it?

#include
#include
using namespace std;
#include
int newt(string s1,string s2)
{unsigned int i=0,j=0;
while(i<s1.length() && j<s2.length())
{ int x=s1[i]-‘0’;
int y=s2[j]-‘0’;
if(x>y)
{
return 1;
}
else if(x<y)
return 0;
i++;
j++;
}
if(i==s1.length() && j!=s2.length()){
if((s1[s1.length()-1]-‘0’)<(s2[0]-‘0’))
return 1;
}

return 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,newt);

	for(int i=0;i<n;i++)
	{
		cout<<s[i];
	}
cout<<"\n";}
return 0;

}

@Himanshu-Sajwan-2271264282963988 hey Himanshu your compare function can be reduced with the help of simple compare function
int compare(string a, string b){

string first = a.append(b);
string second = b.append(a);
return first.compare(second) >0 ? 1:0;
}

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.