Question one hundred and thirteen: Palindromes _ easy version

Source: Internet
Author: User

Print? Description
 
A "text return string" is a string with the same reading and deserialization. For example, "level" or "noon" is a text return string. Write a program to check whether the read string is a "reply ".
 
Input
 
The input contains multiple test instances. The first line of the input data is a positive integer n, indicating the number of test instances. It is followed by n strings, and the length of each string cannot exceed 30.
 
Output
 
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

Description

A "text return string" is a string with the same reading and deserialization. For example, "level" or "noon" is a text return string. Write a program to check whether the read string is a "reply ".

Input

The input contains multiple test instances. The first line of the input data is a positive integer n, indicating the number of test instances. It is followed by n strings, and the length of each string cannot exceed 30.

Output

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


[Plain] # include <stdio. h>
# Include <string. h>
 
Int main ()
{
Int I;
Int flag;
Int num;
Int length;
Char string [101];
 
Scanf ("% d", & num );
Getchar ();
 
While (num --)
{
Gets (string );
Length = strlen (string );
Flag = 1;
 
For (I = 0; I <length-i-1; I ++)
{
If (string [length-i-1]! = String [I])
{
Flag = 0;
}
If (flag = 0)
{
Break;
}
}

If (flag)
{
Printf ("yes ");
}
Else
{
Printf ("no ");
}
 
If (num> 0)
{
Printf ("\ n ");
}
}
 
Return 0;
}

# Include <stdio. h>
# Include <string. h>

Int main ()
{
Int I;
Int flag;
Int num;
Int length;
Char string [101];

Scanf ("% d", & num );
Getchar ();

While (num --)
{
Gets (string );
Length = strlen (string );
Flag = 1;

For (I = 0; I <length-i-1; I ++)
{
If (string [length-i-1]! = String [I])
{
Flag = 0;
}
If (flag = 0)
{
Break;
}
}

If (flag)
{
Printf ("yes ");
}
Else
{
Printf ("no ");
}

If (num> 0)
{
Printf ("\ n ");
}
}

Return 0;
}
 

 
 


 

Related Article

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.