7-12 最长对称子串 (25分)
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include<cmath>
#include<vector>
using namespace std;
string a;
int m = 0;
int solve1(int l, int r)
{
for(;l >= 0 && r < a.size() && a[l] == a[r];l--,r++){}
return r - 1 - (l + 1) + 1;
}
int solve2(int l, int r)
{
for(;l >= 0 && r < a.size() && a[l] == a[r];l--,r++){}
return r - 1 - (l + 1) + 1;
}
int main()
{
getline(cin, a);
for (int i = 0; i < a.size(); m = max(solve2(i,i + 1),max(solve1(i,i), m)),i++){}
cout << m << endl;
}