Palindromes _easy version

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

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

  

posted @ 2019-07-31 10:46  青衫客36  阅读(143)  评论(0编辑  收藏  举报