
open Scanf
open Printf

let id x = x

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f

let () =
  let s = scanf " %s" id in
  let s_len = String.length s in
  for_iter 0 (s_len-1) (fun i ->
    if s.[i] <> s.[i+1] then max (i+1) (s_len-1-i)
    else s_len)
  |> List.fold_left min s_len
  |> printf "%d\n"

