回文子串即从左往右输出和从右往左输出结果是一样的字符串,比如:abba是回文字符串。
输入格式
一个字符串,由字母或数字组成。长度500以内。
输出格式
输出所有的回文子串,每个子串一行 出现位置靠左的优先输出若没有则输出"no"
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main()
{
string a,b,c;
cin >> a;
bool f=true;
for(int i=0;i<a.length()-4;i++)
{
b=a.substr(i,4);
c="";
for(int j=3;j>= 0;j--)
c==c+b[j];
if(c==b)
{
cout << b << endl;
f=false;
}
}
if(f)
cout << "no";
return 0;
}