#include using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::string s; std::cin >> s; int n = s.size(); std::vector dp(n + 1); dp[0] = n; for (int k = 1; k < 2 * n; k++) { int l = (k - 1) / 2, r = k - l; while (l >= 0 && r <= n) { if (s[l] != s[r - 1]) { break; } dp[r] = std::max(dp[r], std::min(dp[l], r - l)); l--, r++; } } std::cout << dp[n] << "\n"; return 0; }