34:次文部分列
查看提交统计问题
总时间限制: 1000ms内存限制: 65536kB
说明
指定字符串,输出长度为2以上的所有回文子串。
回文子串是从左向右输出和从右向左输出的是同一字符串,例如abba、cccdeedccc都是回文字符串。
输入
由字符或数字组成的字符串。 长度500以内。
输出功率
输出所有回文子串。 每个子列都是一行。
子列长度小的优先输出,长度相同的话,位置靠左的优先输出。
样本输入
123321125775165561
样本输出
33
11
77
55
2332
2112
5775
6556
123321
165561
源演习问题(12-6 )。
# include cstdio # include string # include cstring # include iostream # includealgorithmusingnamespacestd; char s[510]; int len; inlinevoidfind(intstart,int end ) { int i; int h=start,t=end; wile(h=t ) if ) s[h]!=s [ t ]。 h; T----; }for(I=start; i=end; I ) printf('%c ',s[i]; printf((n ); 返回; (}int main ) ) { int i,j,k; gets(s; len=Strlen(s; for(k=2; k=len; k ) for(I=0; i=len-k; I )查找(I,i k-1 ); 返回0; }转载于:https://www.cn blogs.com/lris-searching/p/9403188.html