You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.
s = input()
#s = '00001111'
k = 0
l = 1
for i in range(1, len(s)):
    print(s[i-1:i+1])
    if s[i-1:i+1] == '01' or s[i-1:i+1] == '10':
        k = max(k, l)
        l = 1
    else:
        l += 1
print(max(k, l))



s = input()
"""
s = '101'
s = '100000000'
s = '00001011'
"""
k = len(s)
for i in range(1, len(s)):
    if s[i-1] != s[i]:
        k = min(k, max(i, len(s)-i))
print(k)


