class Solution {
public:
bool isPalindrome(int x) {
if(x < 0)
return false;
string str = to_string(x);
int i = 0;
while(isspace(str[i]))
i ++;
str.substr(i);
int len = str.length();
bool odd = (len & 0x00000001) ? true : false;
if(odd) {
for(int i = len/2-1, j = len/2+1; i >= 0 && j < len; i -- , j ++)
if(str[i] != str[j])
return false;
}
else {
for(int i = len/2-1, j = len/2; i >= 0 && j < len; i --, j ++)
if(str[i] != str[j])
return false;
}
return true;
}
};