What is wrong in this code& why am i getting answer as 0


#1

int Solution::isPalindrome(string A) {
string a="";
for(int i=0;i<A.length();i++)
{
if((A[i]>=‘a’&&A[i]<=‘z’)||((A[i]>=‘A’&&A[i]<=‘Z’)))
a+=A[i];
}
int i=0,j=A.size()-1;int flag=1;
while(i<=j)
{
if((a[i]!=toupper(a[j]))||(a[i]!=tolower(a[j])))
{
i++;
j–;
flag=0;
break;
}
i++;
j–;

}

return flag;

}