#include<bits/stdc++.h>
using namespace std;
int expandAroundCenter(string s, int left, int right)
{
int n = s.length();
while (left >= 0 && right < n && s[left] == s[right])
{
left--;
right++;
}
return right - left - 1;
}
int longestPalindrome(string s)
{
if (s.empty()) return 0;
int maxLen = 1;
for (int i = 0; i < s.length(); i++)
{
int len1 = expandAroundCenter(s, i, i);
int len2 = expandAroundCenter(s, i, i + 1);
maxLen = max(maxLen, max(len1, len2));
}
return maxLen;
}
int main()
{
string s;
cin >> s;
cout << longestPalindrome(s);
return 0;
}
//form bíp
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBleHBhbmRBcm91bmRDZW50ZXIoc3RyaW5nIHMsIGludCBsZWZ0LCBpbnQgcmlnaHQpCnsKICAgIGludCBuID0gcy5sZW5ndGgoKTsKICAgIHdoaWxlIChsZWZ0ID49IDAgJiYgcmlnaHQgPCBuICYmIHNbbGVmdF0gPT0gc1tyaWdodF0pCiAgICB7CiAgICAgICAgbGVmdC0tOwogICAgICAgIHJpZ2h0Kys7CiAgICB9CiAgICByZXR1cm4gcmlnaHQgLSBsZWZ0IC0gMTsKfQoKaW50IGxvbmdlc3RQYWxpbmRyb21lKHN0cmluZyBzKQp7CiAgICBpZiAocy5lbXB0eSgpKSByZXR1cm4gMDsKICAgIGludCBtYXhMZW4gPSAxOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzLmxlbmd0aCgpOyBpKyspCiAgICB7CiAgICAgICAgaW50IGxlbjEgPSBleHBhbmRBcm91bmRDZW50ZXIocywgaSwgaSk7CiAgICAgICAgaW50IGxlbjIgPSBleHBhbmRBcm91bmRDZW50ZXIocywgaSwgaSArIDEpOwogICAgICAgIG1heExlbiA9IG1heChtYXhMZW4sIG1heChsZW4xLCBsZW4yKSk7CiAgICB9CiAgICByZXR1cm4gbWF4TGVuOwp9CgppbnQgbWFpbigpCnsKICAgIHN0cmluZyBzOwogICAgY2luID4+IHM7CiAgICBjb3V0IDw8IGxvbmdlc3RQYWxpbmRyb21lKHMpOwogICAgcmV0dXJuIDA7Cn0KLy9mb3JtIGLDrXAK