import qualified Data.Vector as V


odd_solver::V.Vector Char->Int
odd_solver v = let m = div (V.length v) 2 in
               let s = div (V.length (last (filter same [V.slice (m-s) ((2*s)+1) v |s <- [0..m]]))) 2in
               m+s+1

even_solver::V.Vector Char->Int
even_solver v = let m = div (V.length v) 2 in
                let s = div (V.length (last (filter same [V.slice (m-s) (2*s) v | s <- [0..m]]))) 2 in
                m+s

same::V.Vector Char->Bool
same v        =if v == V.empty then True else V.foldl (\ b -> \ x -> ((V.head v)==x)&&b) True v

total_solver::String->Int
total_solver ls = let v = V.fromList ls in
                  if mod (V.length v) 2 == 1 then odd_solver v else even_solver v

main::IO()
main=do
  str<-getLine
  print (total_solver str)