
#include <iostream>
#include <string>
using namespace std;
string extend(string s, int i, int j, int n) {
while(i >= 0 && j < n && s[i] == s[j]) {
i--;
j++;
}
return s.substr(i+1, j-i-1);
}
int main() {
string str;
getline(cin, str);
if(str.size() == 0 || str.size() == 1)
return 0;
string res = " ";
for(int i = 0; i < str.size(); i++) {
string s1 = extend(str, i, i, str.size());
string s2 = extend(str, i, i+1, str.size());
res = res.size() > s1.size() ? res : s1;
res = res.size() > s2.size() ? res : s2;
}
cout << res.size() << endl;
return 0;
}