why I got WA in Lapindromes problem.
problem link
solution->
#include
#include<bits/stdc++.h>
#include
using namespace std;
int main()
{
//cout << “Hello world!” << endl;
int t;
cin>>t;
while(t–)
{
string str;
cin>>str;
int l=str.length(),count=0,x=0,y=0,z=0;
if(l%2==0)
{
for(int i=0;i<l/2;i++)
{
if(str[i]<='z')
{
count=count+str[i];
}
}
//cout<<count<<endl;
for(int i=l/2;i<=l;i++)
{
if(str[i]<='z')
x=x+str[i];
}
if(x==count)
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}
else
{
for(int i=0;i<l/2;i++)
{
if(str[i]<='z')
{
y=y+str[i];
}
}
//cout<<count<<endl;
for(int i=l/2+1;i<=l;i++)
{
if(str[i]<='z')
z=z+str[i];
}
if(y==z)
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}
//cout<<y<<" "<<z;
}
return 0;
}