Code works perfectly in local IDE. But shows wrong answer in CB editor

So i ran my code on the local IDE and it worked for multiple test cases and the answers i got were correct. But when i submit my answers in CB, the compiler shows wrong answer. Could you please help me fix this issue.
I am pasting the code here as the online CB editor does not show the link to share.
#include
#include
#include
#include
#include<bits/stdc++.h>
using namespace std;

int myCompare(string a, string b){
return a + b > b + a;
}

int main() {
int t;
cin >> t;
while (t–) {

	int n;
	cin >> n;
	string arr[n];
	for (int i = 0; i < n; ++i){
	cin >> arr[i];
	}
	sort(arr, arr + n, myCompare);

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

}

this is because you don’t print ans of each testcase in different line
use endl after printing array

Modified Code

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.