this is my c code for the given problem

can anyone please tell me why this code is wrong

```
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
char *a, *b,*c,p;
a=(char*)calloc(1001,sizeof(char));
scanf("%s",a);
int l,mid,i,j,ans;
ans=1;
l=strlen(a);
mid=l/2;
b=(char*)calloc(l/2,sizeof(char));
c=(char*)calloc(l/2,sizeof(char));
if(l%2)
{
for(i=0;i<mid;i++)
b[i]=a[i];
for(i=mid+1;i<l;i++)
c[i-mid-1]=a[i];
}
else
{
for(i=0;i<mid;i++)
b[i]=a[i];
for(i=mid;i<l;i++)
c[i-mid]=a[i];
}
for(i=0;i<mid;i++)
{
p=b[i];
for(j=0;j<mid;j++)
if(c[j]==p)
{
c[j]='\0';
break;
}
}
for(i=0;i<mid;i++)
if(c[i]!='\0')
ans=0;
if(ans)
printf("yes");
else
printf("no");
}
}
```