#include <cstdio> #include <cstring> #define N 22200000 #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) int p[N]; char s[N]; int pos = 1, maxright, ans, n; int main() { int i, j; scanf("%s", s + 1); n = strlen(s + 1); s[0] = '$', s[n * 2 + 1] = '#'; for(i = n; i >= 1; i--) s[i * 2] = s[i], s[i * 2 - 1] = '#'; n = n * 2; for(i = 1; i <= n; i++) { p[i] = 1; if(i <= maxright) p[i] = min(p[pos * 2 - i], maxright - i + 1); while(s[i - p[i]] == s[i + p[i]]) p[i]++; if(maxright < i + p[i] - 1) { pos = i; maxright = i + p[i] - 1; } ans = max(ans, p[i] - 1); } printf("%d ", ans); return 0; }