注:size_t 声明表示一种无符号整数,他是一种能够以字节为单位表示任何对象大小的类型,size_t 通常是 sizeof 运算符的返回类型,广泛用于标准库中以表示大小和计数
#include
#include
#include
#include
using std::vector;
using std::string;
using std::stack;
using std::cout;
using std::endl;
using std::cin;
int main()
{
string str;
getline(cin, str);
size_t mid = str.size() / 2;
stack
for (size_t i = 0; i != mid; i++)
int_stack.push(str[i]);
size_t next = 0;
if (str.size() % 2 == 0) //if the number of str is even
next = mid;
else //if the number of str is odd
next = mid + 1;
for (size_t i = next; i != str.size(); i++)
{
if (str[i] != int_stack.top())
break;
int_stack.pop();
}
if (int_stack.empty())
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}