#include <iostream>
using namespace std;

int main() {
	// your code goes here
string s;
cin>>s;

int ans=s.length();
for(int i=0;i<s.length()-1;i++)
{
	if(s[i]!=s[i+1])
	ans=min(ans,max(i+1,(int)s.length()-i-1));
}
;
cout<<ans<<endl;
}