#include<iostream>
using namespace std;
bool judge(string str) {
// write code here
int l=0;
int r=str.size()-1;
while(l<r){
if(str[l]!=str[r])return false;
l++;
r--;
}
return true;
}
int main(){
cout<<"请输入要判断的字符串:"<<endl;
string a;
cin>>a;
if(judge(a))cout<<"是回文字符串"<<endl;
else cout<<"不是回文字符串"<<endl;
}

京公网安备 11010502036488号