

S = eval(input())

l=len(S)

if l%2==0:

    count=0

    s=S[int(l/2)]

    for i in range(int(l/2)):

        if S[int(l/2)-1-i]!=s or S[int(l/2)+i]!=s:

            break

        count+=1

    print((int(l/2)+count))

else:

    s=S[int(l/2)]

    count=0

    for i in range(int(l/2)):

        if S[int(l/2)-1-i]!=s or S[int(l/2)+1+i]!=s:

            break

        count+=1

    print((int(l/2)+1+count))
S=eval(input())



l=len(S)



if l%2==0:

    count=l//2

    a=S[l//2-1]

    for i in range(l//2):

        if S[l//2-1-i]==a and S[l//2+i]==a:

            count+=1

        else:

            break

    print(count)

else:

    count=l//2+1

    a=S[l//2]

    for i in range(l//2):

        if S[l//2-1-i]==a and S[l//2+1+i]==a:



            count+=1

        else:

            break

    print(count)
S = eval(input())
l = len(S)
if l % 2 == 0:
    count = 0
    s = S[int(l / 2)]
    for i in range(int(l / 2)):
        if S[int(l / 2) - 1 - i] != s or S[int(l / 2) + i] != s:
            break
        count += 1
    print((int(l / 2) + count))
else:
    s = S[int(l / 2)]
    count = 0
    for i in range(int(l / 2)):
        if S[int(l / 2) - 1 - i] != s or S[int(l / 2) + 1 + i] != s:
            break
        count += 1
    print((int(l / 2) + 1 + count))

S = eval(input())
l = len(S)
if l % 2 == 0:
    count = l // 2
    a = S[l // 2 - 1]
    for i in range(l // 2):
        if S[l // 2 - 1 - i] == a and S[l // 2 + i] == a:
            count += 1
        else:
            break
    print(count)
else:
    count = l // 2 + 1
    a = S[l // 2]
    for i in range(l // 2):
        if S[l // 2 - 1 - i] == a and S[l // 2 + 1 + i] == a:
            count += 1
        else:
            break
    print(count)

-    count = 0 -    s = S[int(l / 2)] -    for i in range(int(l / 2)): -        if S[int(l / 2) - 1 - i] != s or S[int(l / 2) + i] != s: +    count = l // 2 +    a = S[l // 2 - 1] +    for i in range(l // 2): +        if S[l // 2 - 1 - i] == a and S[l // 2 + i] == a: +            count += 1 +        else: -        count += 1 -    print((int(l / 2) + count)) +    print(count) -    s = S[int(l / 2)] -    count = 0 -    for i in range(int(l / 2)): -        if S[int(l / 2) - 1 - i] != s or S[int(l / 2) + 1 + i] != s: +    count = l // 2 + 1 +    a = S[l // 2] +    for i in range(l // 2): +        if S[l // 2 - 1 - i] == a and S[l // 2 + 1 + i] == a: +            count += 1 +        else: -        count += 1 -    print((int(l / 2) + 1 + count)) +    print(count)