s = io.read('l')

ans1 = #s

for i = 1, #s do
    if s:byte(i) == 49 then
        ans1 = math.min(ans1, math.max(i, #s - i + 1))
    end
end

ans2 = #s

for i = 1, #s do
    if s:byte(i) == 48 then
        ans2 = math.min(ans2, math.max(i, #s - i + 1))
    end
end

print(math.max(ans1, ans2) - 1)
