Simple echo string

Source: Internet
Author: User

Tablet cool

* Simple echo string
Time Limit: 1000 MS memory limit: 32 MB
Description
The "Reply string" is a string with the same reading and reverse reading, such as "level" or "Noon"
And so on. Write a program to check whether the read string is a "reply ".
Input description
The input contains multiple test instances. The first line of the input data is a positive integer N, indicating
Number, followed by N strings.
Output description
If a string is a return string, "yes" is output; otherwise, "no" is output ".
Sample Input
4
Level
ABCDE
Noon
Haha
Sample output
Yes
No
Yes
No
*/
# Include <stdio. h>
# Include <string. h>
Int ishuiwen (char STR [], int N)
{
Int I;
For (I = 0; I <= N & STR [I ++] = STR [-- N];);
If (I = n + 2 | I = n + 1)
Return 1;
Else
Return 0;
}
Int main (void)
{
Char STR [100];
Int N, I, j, TEM [100];

While (scanf ("% d", & n) + 1 ){
For (j = I = 0; I <n; ++ I ){
Scanf ("% s", STR );
Getchar ();
If (ishuiwen (STR, strlen (STR )))
TEM [J ++] = 1;
Else
TEM [J ++] = 0;
}
For (I = 0; I <j; ++ I ){
If (TEM [I])
Printf ("Yes/N ");
Else
Printf ("No/N ");
}
}
Return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.