#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
string str;
cin>>str;
vector<char> temp;
for(int i=0; i<str.size(); i++)
{
if((str[i]>='a'&&str[i]<='z')||(str[i]>='0'&&str[i]<='9'))
temp.push_back(str[i]);
else if(str[i]>='A'&&str[i]<='Z')
temp.push_back(tolower(str[i]));
}
int i=0,j=temp.size()-1;
while (i<j)
{
if(temp[i] != temp[j])
{
cout<<"false";
return 0;
}
i++;
j--;
}
if(i<=j)
cout<<"true";
return 0;
}
Leetcode125题.验证回文串
最新推荐文章于 2024-07-25 21:11:40 发布