#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    string str;
    cin>>str;
    int maxl=0;
    int len=str.size();
    for(int i=0;i<len;i++){
        int low=i-1,high=i;
        while(low>=0&&high<len&&str[low]==str[high]){
            low--;
            high++;
        }
        maxl=max(maxl,high-low-1);
        low=i-1,high=i+1;
         while(low>=0&&high<len&&str[low]==str[high]){
            low--;
            high++;
        }
         maxl=max(maxl,high-low-1);
    }
    cout<<maxl<<endl;
}
// 64 位输出请用 printf("%lld")