I'm Getting wrong answer , for Lapindrome Problem easy section. please help

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

char str1[1000];
char str2[1000];
int sortpart(int b)
{
if(b%2==0)
return 0;
else
return 1;
}
int value1( int m)
{

	int c=m/2;
if(m%2==1)
{


 return c;
}
else
 return c-1;

}

int main()
{

int t;
cin>>t;
for(int tt=0;tt<t;++tt)
{
	char str[1000];
	cin>>str;
	int cnt1=0,cnt2=0;
	int x=strlen(str); int temp1=x/2;
	
	
	 
	 sort(str,str+temp1);
	 int value=sortpart(x);
	 sort(str+temp1+value,str+x);
	 
	 for(int i=0;i<x;++i)
	 {
	 	if(i<=temp1-1)
	 	{
	 		
	 		str1[cnt1]=str[i];
	 		cnt1++;
	 	}
	 	else if(i>value1(x))
	 	 {
	 	 	
	 	 	str2[cnt2]=str[i];
	 	 	cnt2++;
	 	 }
	 	 
	 }
	 
	 if(strcmp(str1,str2)==0)
	 {
	 	cout<<"YES"<<endl;
	 }
	 else 
	  cout<<"NO"<<endl;
	 
	
	
}
return 0;

}