#include <iostream>
#include <cstring>
using namespace std;
int main()
{
bool flag = true;
char str[100];
cin >> str;
int len = strlen(str);
for(int i = 0; i < len/2; ++i)
{
if (str[i]!=str[len - i - 1])
{
flag = false;
}
}
if (flag)
cout << "true" << endl;
else
cout << "false" << endl;
}
我编的这个,一个词是可以判断的,比如assa等等
但一旦是句子,也就是说有了空格,就无法正常判断了……请问应该怎么改呢?