#125. Valid Palindrome 题目链接
int isAlphanumeric(char c)
{
if ((c>='a'&&c<='z') || (c>='A'&&c<='Z') || c>='0'&&c<='9')
return 1;
return 0;
}
char toLowerCase(char c)
{
if (c>='A' && c<='Z')
return c - ('A' - 'a');
return c;
}
int isPalindrome(char *s)
{
int start=0,end = 0;
while(s[end] != '\0')
{
end++;
}
while(start != end && start-1 != end)
{
if(!isAlphanumeric(s[start]))
{
start++;
continue;
}
if(!isAlphanumeric(s[end]))
{
end--;
continue;
}
if(toLowerCase(s[start]) != toLowerCase(s[end]))
{
return 0;
}
start++;end--;
}
return 1;
}