can someone plz tell me why my Lapindrome code gives a wrong answer…it is workng fine for the test cases mentioned in example
#include<stdio.h>
#include<string.h>
int lapindrome(char[]);
int main()
{
int cases=0,j=0,f=0;
char str[1000];
scanf("%d",&cases);
while(j<cases)
{
scanf("%s",str);
f=lapindrome(str);
if(f==0)
printf("NO\n");
else printf("YES\n");
j++;
}
return 0;
}
int lapindrome(char str[1000])
{
char arr[500];
int l=strlen(str),i,k;
for(i=0,k=0;i<l/2;i++,k++)
{
arr[k]=str[i];
}
if(l%2==0)
i=l/2;
else
i=l/2+1;
while(i<l)
{
for(k=0;k<l/2;k++)
{
if(str[i]==arr[k])
{
arr[k]='#';
break;
}
}
i++;
}
for(k=0;k<l/2;k++)
{
if(arr[k]!='#')
return 0;
}
return 1;
}