#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include <algorithm>
using namespace std;
int i,j,k,len;
char s[1000];
int check(int st,int l)
{
int le,ri;
le=st;ri=st+l-1;
while (le<ri)
if (s[le++]!=s[ri--]) return 0;
return 1;
}
int main()
{
cin>>s;
len=strlen(s);
for (j=2;j<=len;++j){
for (i=0;i<len-j+1;++i)
if (check(i,j)){
for (k=i;k<=i+j-1;++k)
cout<<s[k];
cout<<endl;
}
}
return 0;
}
回文子串
最新推荐文章于 2023-07-22 22:56:15 发布