class Solution {
public:
bool isPalindrome(string s) {
string good;
for(auto a:s)
{
if(isalnum(a))
good+=tolower(a);//对应的是tolower()
}
cout<<good<<endl;
string revgood(good.rbegin(),good.rend());
return revgood==good;
}
};
保留string字母数字并转换大小写的方法
最新推荐文章于 2023-09-14 15:24:44 发布