 # WA in LAPIN (yet again)

p;https://onlinegdb.com/SkmMt-ikI
q; https://www.codechef.com/problems/LAPIN
how can I make it correct??

instead of too much comparisions just maintain frequency array for each character for both halves of string then compare on the basis of frequency array it will be quite easy and clear.
you can checkout my code.

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
immortal_mark
AMAN KUMAR SINGH
IET LUCKNOW
JUST CODE FOR FUN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#include<bits/stdc++.h>
#define fast_inou ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
using namespace std;
int main()
{
fast_inou

int t;
cin>>t;
while(t–)
{
int c,d,i,p=0;
for(i=0;i<=26;i++)
{
c[i]=0;
d[i]=0;
}
string s;
cin>>s;
int l=s.length();
if(l%2==0)
{
for(i=0;i<l/2;i++)
{
c[s[i]-97]=c[s[i]-97]+1;
}
for(i=l/2;i<l;i++)
{
d[s[i]-97]=d[s[i]-97]+1;
}
}
else
{
for(i=0;i<l/2;i++)
{
c[s[i]-97]=c[s[i]-97]+1;
}
for(i=(l+1)/2;i<l;i++)
{
d[s[i]-97]=d[s[i]-97]+1;
}
}
for(i=0;i<27;i++)
{
if(c[i]==d[i])
{
p=p+1;
}
}
if(p==27)
{
cout<<“YES”<<endl;
}
else
{
cout<<“NO”<<endl;
}
}
return 0;
}

c[s[i]-97]=c[s[i]-97]+1
int c,d,i,p=0;
why you are using 97 and 27 ?