Codeup 5,901 back to the text string

Source: Internet
Author: User

title address:http://www.codeup.cn/problem.php?cid=100000580&pid=8

Title Description:

Read a string of characters to determine if it is a palindrome string. "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.

Input:

A line of string, not exceeding 255 length.

Output:

If it is a palindrome string, output "YES", otherwise output "NO".

Sample Input:

12321

Sample output:

YES

The complete code is as follows:

 #include <cstdio> #include <cstring> const int MAXN = 256;  Determine if the string str is "palindrome string" bool Judge (char str[]) {int len = strlen (str); string length for (int i = 0; i < LEN/2; i++) {//I enumeration string first half if (str[i]! = str[len-1-i]) {Retu   RN false;            Not "Palindrome string"}} return true;
    Is "palindrome string"} int main () {char STR[MAXN];     while (gets (str)) {//input string BOOL flag = Judge (str);              Determine if the string str is "palindrome string" if (flag = = True) {//"palindrome" printf ("yes\n");//Output YES}else{     Not "palindrome" printf ("no\n"); 
Output NO}} 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.