main = do
  xs <- getLine
  print $ solve xs 0 (length xs) 0

solve [_] _ _ k = k
solve (x:xs) m n k
  | x /= head xs = solve xs (m + 1) (n - 1) (maximum [k, m, n])
  | otherwise = solve xs (m + 1) (n - 1) k