S=eval(input())

N=K=len(S)

for i in range(1,N):

    if S[i-1]!=S[i]:

        K=min(K,max(i,N-i))

print(K)
S=eval(input())

N=len(S)

print((min([max(i,N-i) for i in range(1,N) if S[i-1]!=S[i]],default=N)))
S = eval(input())
N = K = len(S)
for i in range(1, N):
    if S[i - 1] != S[i]:
        K = min(K, max(i, N - i))
print(K)

S = eval(input())
N = len(S)
print((min([max(i, N - i) for i in range(1, N) if S[i - 1] != S[i]], default=N)))

-N = K = len(S) -for i in range(1, N): -    if S[i - 1] != S[i]: -        K = min(K, max(i, N - i)) -print(K) +N = len(S) +print((min([max(i, N - i) for i in range(1, N) if S[i - 1] != S[i]], default=N)))