#include <stdio.h>
#include <string.h>
#define LEN 350
int main() {
char s[LEN];
while (scanf("%s", s) != EOF) {
int len = strlen(s);
int maxlen = 0;
int tempi, tempj, tempmax;
for(int i = 0; i < len; i++) {
tempmax = 0;
tempi = i;
tempj = i + 1;
while((tempi >= 0) && (tempj < len) && (s[tempi--] == s[tempj++])) {
tempmax++;
}
if(tempmax * 2 > maxlen) maxlen = tempmax * 2;
tempmax = 0;
tempi = i;
tempj = i + 2;
while((tempi >= 0) && (tempj < len) && (s[tempi--] == s[tempj++])) {
tempmax++;
}
if(tempmax * 2 + 1 > maxlen) maxlen = tempmax * 2 + 1;
}
printf("%d\n", maxlen);
}
return 0;
}