class Solution {
public:
static bool equal(char c1, char c2)
{
if(c1 == c2)
return true;
if(c1 > c2)
return (c1 -32 == c2);
return (c1+32 == c2);
}
bool Alpha(char c)
{
if(c >='A' && c <='Z')
return true;
if(c >='a' && c <='z')
return true;
if(c >= '0' && c <='9')
return true;
return false;
}
bool isPalindrome(string s) {
int front = 0, back = s.size() -1;
while(front < back)
{
if(!Alpha(s[front]))
{
front++;
continue;
}
if(!Alpha(s[back]))
{
back--;
continue;
}
if(equal(s[front], s[back]))
{
front++;
back--;
}
else
return false;
}
return true;
}
};