When running the following code in online judge , its giving wrong answer cant figure out why , can anyone please help ?
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
int lFreq[26];
int rFreq[26];
for (int i = 0; i < 26; ++i)
{
lFreq[i]=0;
rFreq[i]=0;
}
// For Left Part Of The String
for(int i = 0; i<s.length()/2; i++){
char curr = s[i];
lFreq[curr-'a']++;
}
// For Right Part Of The Array
for(int i = (s.length()+1)/2 ; i<s.length(); i++){
char curr = s[i];
rFreq[curr-'a']++;
}
bool isSame = true;
for(int i =0; i<26; i++){
if(lFreq[i]!=rFreq[i]){
isSame=false;
break;
}
}
if(isSame){
cout<<"YES"<<endl;
}
else
{
cout<<"N0"<<endl;
}
}
}