Help me in solving ABSTRING problem

My issue

my approach is if n is odd simply return no and if n is even then, I traverse the string and do XOR of every character of string if after traversing all the character the XOR is zero i simply return Yes and if not return No.

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	
	while(t--){
	    long long int n;
	    cin>>n;
	    
	    string s;
	    cin>>s;
	    
	    if(n%2 != 0){
	        cout<<"NO"<<endl;
	    }
	    else{
	        long long int xor1 = 0;
	        for(int i=0; i<n; i++){
	            xor1 = xor1^s[i];
	        }
	        if(xor1 == 0){
	            cout<<"YES"<<endl;
	        }
	        else{
	            cout<<"NO"<<endl;
	        }
	    }
	}
	return 0;
}

Problem Link: ABSTRING Problem - CodeChef