https://pintia.cn/problem-sets/994805046380707840/exam/problems/994805067704549376?type=7&page=1
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define oz 998244353
#define N 200010
#define INF 0x3f3f3f3f
typedef long long ll;
const int mod = 1e9 + 7;
void solve() {
string a;
getline(cin, a);
int n = a.size();
int res = 1;
for (int i = 0; i < n; i++) {
for (int j = n - 1; j > i; j--) {
if (a[i] == a[j]) {
int k;
for (k = i; k <= (i + j) / 2; k ++) {
if (a[k] != a[i + j - k])break;
}
if (k > (i + j) / 2)res = max(res, j - i + 1);
}
}
}
cout << res << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T --)
solve();
return 0;
}