hdoj:2029

#include <iostream>
#include <string>
using namespace std;

bool isPalindromes(string s)
{
    int len = s.size();
    int l = 0, r = len - 1;
    while (l < r)
    {
        if (s[l] != s[r])
            return false;
        l++;
        r--;
    }
    return true;
}
int main()
{
    int n;
    while (cin >> n)
    {
        string s;
        for (int i = 1; i <= n; i++)
        {
            cin >> s;
            if (isPalindromes(s))
            {
                cout << "yes" << endl;
            }
            else
            {
                cout << "no" << endl;
            }
        }
        

    }
}
原文地址:https://www.cnblogs.com/bbbblog/p/6000783.html