# -*- coding: utf-8 -*-

S = eval(input())

for k in range((len(S)+1)//2-1, len(S)-1):

    if S[k] != S[k+1] or S[-k-1] != S[-k-2]:

        print((k+1))

        break

else:

    print((len(S)))
S = eval(input())

N = len(S)

for k in range((N+1)//2, N):

    if S[k-1] != S[k] or S[-k] != S[-k-1]:

        print(k)

        break

else:

    print(N)
# -*- coding: utf-8 -*-
S = eval(input())
for k in range((len(S) + 1) // 2 - 1, len(S) - 1):
    if S[k] != S[k + 1] or S[-k - 1] != S[-k - 2]:
        print((k + 1))
        break
else:
    print((len(S)))

S = eval(input())
N = len(S)
for k in range((N + 1) // 2, N):
    if S[k - 1] != S[k] or S[-k] != S[-k - 1]:
        print(k)
        break
else:
    print(N)

-# -*- coding: utf-8 -*- -for k in range((len(S) + 1) // 2 - 1, len(S) - 1): -    if S[k] != S[k + 1] or S[-k - 1] != S[-k - 2]: -        print((k + 1)) +N = len(S) +for k in range((N + 1) // 2, N): +    if S[k - 1] != S[k] or S[-k] != S[-k - 1]: +        print(k) -    print((len(S))) +    print(N)