public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param str string字符串
* @return bool布尔型
*/
bool palindrome(string str) {
// write code here
int n = str.length();
bool b = false;
for (int i=0; i<n/2; ++i) {
if (str[i] != str[n - i - 1]) {
if (b) {
return false;
}
b = true;
}
}
return true;
}
};