Problem Description
"Palindrome string" is a literal reading and anti-read all the same string, such as "level" or "noon" and so on is a palindrome string. Please write a program to determine whether the read-in string is a "palindrome".
Input
The input contains multiple test instances, the first line of the input data is a positive integer n, which indicates the number of test instances followed by n strings. Each string length does not exceed 150.
Output
If a string is a palindrome, output "yes", otherwise output "no".
Sample Input
4
Level
Abcde
Noon
haha
Sample Output
Yes
No
Yes
No
1#include <stdio.h>2 3#include <string.h>4 5 intFunChara[])6 7 { 8 9 intI,k,r=1; Ten OneK=strlen (a)-1; A - for(i=0; I<=k;k--, i++) - the { - - if(a[i]!=A[k]) - + { - +R=0; A at Break; - - } - - } - in returnR; - to } + - intMain () the * { $ Panax Notoginseng Chara[ -]; - the intI,n; + Ascanf"%d",&n); the + for(i=0; i<n;i++) - $ { $ -scanf"%s",&a); - the if(Fun (a) = =0) - Wuyiprintf"no\n"); the - Else Wu -printf"yes\n"); About $ } - - return 0; - A}
#include <stdio.h>#include<string.h>intMain () {Charstr[ -]; intn,i,j; scanf ("%d",&N); while(n>0) {scanf ("%s", str); I=0; J=strlen (str)-1; while(i<=j) {if(str[i]!=Str[j]) Break; I++; J--; } if(i>j) printf ("yes\n"); Elseprintf ("no\n"); N--; } return 0;}
Wuhan University of Science and Technology acm:1004:0 starting point algorithm 74--palindromes _easy version