#include <algorithm> #include <bits/stdc++.h> using namespace std; int main() { string line; getline(cin, line); vector<vector<bool>> dp(line.size(), vector<bool>(line.size(), false)) ; int max1 = 1; for(int right = 0; right < line.size(); ++right) { for(int left = right; left >= 0; --left) { if(line[left] == line[right]) { if(right - left <= 2 || dp[left + 1][right - 1]) dp[left][right] = true; if(dp[left][right]) max1 = max(max1, right - left + 1); } } } cout << max1; }