import Control.Monad
import qualified Data.ByteString.Char8 as BS

readString = map BS.unpack . BS.words

getString = readString <$> BS.getLine

cc :: Char -> [String] -> [[String]]
cc c [] = [[[c]]]
cc c [x] = [[[c], x], [(c : x)]]
cc c xs = xs'''
  where
    xs' = []
    xs'' = if [c] /= (head xs) then ([c] : xs) : xs' else xs'
    xs''' = if (c : (head xs)) /= head (tail xs) then ((c : (head xs)) : tail xs) : xs'' else xs''

usecc :: Char -> [[String]] -> [[String]]
usecc c [] = []
usecc c (xs : xss) = (cc c xs) ++ (usecc c xss)

calc :: String -> [[String]] -> [[String]]
calc [] xss = xss
calc (c : cs) [] = calc cs [[[c]]]
calc (c : cs) xss = calc cs xss'
  where
    xss' = usecc c xss

main = do
  [cs] <- getString
  print $ maximum (map length (calc cs []))
