unittest
{
	assert( [ "010" ].parse.expand.solve == 2 );
	assert( [ "100000000" ].parse.expand.solve == 8 );
	assert( [ "00001111" ].parse.expand.solve == 4 );
	
	assert( [ "11111111" ].parse.expand.solve == 8 );		// 追加ケース
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto ans = s.length.signed;
	for( auto i = 1L; i < s.length; i++ )
	{
		if( s[ i - 1 ] != s[ i ] ) ans = min( ans, max( i, s.length.signed - i ) );
	}
	return ans;
}
