S = list(eval(input()))

lenS = len(S)

S = S + ['.']

K = lenS

i = 0

ps = S[0]

for s in S:

    if s != ps:

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

        ps = s

    i += 1

print(K)
def main():

    S = eval(input())

    l = len(S)

    ans = l

    #データ加工

    for i, s in enumerate(S[1:]):

        if s != S[i]:

            ans = min(ans, max(i+1, l-1-i))

    print(ans)

    

main()
S = list(eval(input()))
lenS = len(S)
S = S + ["."]
K = lenS
i = 0
ps = S[0]
for s in S:
    if s != ps:
        K = min(K, max(i, lenS - i))
        ps = s
    i += 1
print(K)

def main():
    S = eval(input())
    l = len(S)
    ans = l
    # データ加工
    for i, s in enumerate(S[1:]):
        if s != S[i]:
            ans = min(ans, max(i + 1, l - 1 - i))
    print(ans)


main()

-S = list(eval(input())) -lenS = len(S) -S = S + ["."] -K = lenS -i = 0 -ps = S[0] -for s in S: -    if s != ps: -        K = min(K, max(i, lenS - i)) -        ps = s -    i += 1 -print(K) +def main(): +    S = eval(input()) +    l = len(S) +    ans = l +    # データ加工 +    for i, s in enumerate(S[1:]): +        if s != S[i]: +            ans = min(ans, max(i + 1, l - 1 - i)) +    print(ans) + + +main()