let () =
  let s = read_line () in
  Array.init (String.length s) (fun i ->
    let k = max i (String.length s - i - 1) in
    if s.[i] = '0'
    then (max_int, k)
    else (k, max_int))
  |> Array.fold_left (fun (a, b) (c, d) -> (min a c, min b d)) (max_int, max_int)
  |> (fun (a, b) -> max a b)
  |> Printf.printf "%d\n"
