https://www.codechef.com/LRNDSA01

https://www.codechef.com/LRNDSA01

#include
#include
#include
using namespace std;

int main() {
// your code goes here
int t;
scanf("%d",&t);
if(t>=1 && t<=100)
{
while(t–)
{
string str;
cin>>str;
int l=str.length();
if(l>=2 && l<=2000)
{
string s1(str.begin(),str.begin()+l/2);
string s2(str.begin()+ceil(l/2.0),str.end());

    int n=s1.length();
    int arr[n]={0};
    for(int i=0;i<s1.length();i++)
    {
         for(int j=0;j<s2.length();j++)
         {
             if(s1.at(i)==s2.at(j))
             {
                arr[i]++;
             }
         }
         if(arr[i]>=2 || arr[i]==0)
         break;
    }
     for(int i=0;i<s1.length();i++)
 {
     if(arr[i]!=1)
     {
         cout<<"NO"<<endl;
         break;
     }
     else if (arr[i]==1 && i==s1.length()-1)
        	 cout<<"YES"<<endl;

 }

    }
    
}

}


return 0;

}

can anybody help me?