#include <cstdio>
#define Min(x, y) x < y ? x : y
#define Max(x, y) x > y ? x : y
using namespace std;
int n = 0, p[22000009], ans;
char s[22000009];
void get_S();
int main() {
get_S();
for (int i = 1, mid = 0, r = 0; i<= n; ++i) {
p[i] = Min(p[(mid << 1) - r], r - i + 1);
while (s[i - p[i]] == s[i + p[i]]) ++p[i];
if (i + p[i] - 1 > r) mid = i, r = p[i] + i - 1;
ans = Max(ans, p[i] - 1);
}
printf("%d\n", ans);
return 0;
}
void get_S() {
s[++n] = '~'; s[++n] = '|';
char c = getchar();
while (c >= 'a' && c <= 'z')
s[++n] = c, s[++n] = '|', c = getchar();
}
rt, 在第15行本来应该是p[i] = Min(p[(mid << 1) - i], r - i + 1), 但是错写成了p[i] = Min(p[(mid << 1) - r], r - i + 1)