#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include <iostream>
#include <algorithm>

using namespace std;
#define INF 0x3f3f3f3f

const int maxn = 1e6 + 100;

char s[maxn];



int main()
{
	while(scanf("%s",s)!= EOF){
		int len = strlen(s),ans = len;
		for(int i = 1;i < len;i++){
			if(s[i-1] != s[i])
				ans = min(ans,max(i,len-i));
		}
		printf("%d\n",ans);
	}
	return 0;
}
