local s = io.read()
local n = #s
local prv = s:sub(1, 1)
local nxt = ""
local from = 1
local ret = 1
local mma, mmi = math.max, math.min
for i = 2, n do
  nxt = s:sub(i, i)
  if prv ~= nxt then
    ret = mma(ret, mmi(i - 1, n + 1 - from))
    prv = nxt
    from = i
  end
end
ret = mma(ret, mmi(n, n + 1 - from))
print(ret)
