34: replies, 34 replies

Source: Internet
Author: User

34: replies, 34 replies

 

34: reply string
  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

If a string is specified, all response substrings with at least 2 characters are output.

The return substring is the same as the output result from left to right. For example, abba and cccdeedccc are the return strings.

Input
A string consisting of letters or numbers. Length less than 500.
Output
Output all input substrings, one row for each substring.
If the length of a substring is equal to the length of the substring, the output is prioritized from the left to the left.
Sample Input
123321125775165561
Sample output
331177552332211257756556123321165561
Source
Exercise (12-6)
 1 #include<cstdio> 2 #include<cstring> 3 char c[505]; 4 int main() { 5     int n; 6     scanf("%s",c); 7     n=strlen(c); 8     for(int l=2; l<=n; ++l) 9         for(int i=0; i+l<=n; ++i) 10         {11             bool flag=0;12             for(int j=i; j<i+l; ++j)13                 if(c[j]!=c[i+l-j+i-1]) 14                 {15                     flag=1;16                     break;17                 }18             if(!flag) 19             {20                 for(int j=i; j<i+l; ++j)21                 printf("%c",c[j]);22                 printf("\n");23             }24         }25     return 0;26 }

 

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.