POJ 2029 Palindromes _easy version

 1 #include<cstdio>
 2 #include<cstring>
 3 using namespace std;
 4 int main()
 5 {
 6     int n;
 7     char str[100000];
 8     scanf("%d", &n);
 9     while(n--)
10     {
11         scanf("%s", str);
12         int len = strlen(str);
13         int flag = 1;
14         for(int i = 0, j = len-1; i <= j; i++, j--)
15         {
16             if(str[i] != str[j])
17             {
18                 flag = 0;
19                 break;
20             }
21         }
22         if(!flag) printf("no
");
23         else printf("yes
");
24     }
25     return 0;
26 }
View Code
原文地址:https://www.cnblogs.com/loveprincess/p/4920128.html