#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
const int maxn = 1e5 + 100;
char s[maxn];
int main()
{
	scanf("%s",s);
	int len = strlen(s);
	int res = len;
	for (int i = 1; i < len; i++)
	{
		if (s[i] != s[i - 1])
			res = min(res,max(i,len-i));
	}
	printf("%d\n", res);
	return 0;
}

