#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
string S;
int k[10000]={0};
int main()
{
    while(cin>>S)
    {int len=S.size();
    int i=0,j;
    int count=0;
    for(j=1;j<len;j++)
     if(S[j]!=S[j-1])
        {
            k[count++]=max(j,len-j);
           // cout<<k[]
        }
    sort(k,k+count);
    cout<<k[count-1]<<endl;
    }
}

