let () =
  let s = read_line () in
  Array.init (String.length s - 1) (fun i ->
    if s.[i] <> s.[i + 1] then max (i + 1) (String.length s - i - 1)
    else max_int)
  |> Array.fold_left min max_int
  |> Printf.printf "%d\n"
