#include <iostream>
#include <string>
#include <algorithm> //reverse()
using namespace std;
int main()
{
//string aa = "abcba";
//string aa = " ";
int len=aa.size();
string bb = aa;
reverse(bb.begin(),bb.end());
if(aa==bb)
{
cout << "true" << endl;
}
else
{
cout << "false" << endl;
}
return 0;
}
判断字符串是否是回文串——算法笔记
最新推荐文章于 2021-07-09 16:49:23 发布