main = do
  s <- getLine
  putStr . show . minimum $ [(k . f c) s | c <- s]
  
f c cs = [c == d | d <- cs]
 
h n xs
  | n >= length xs = 0
  | xs !! n = 1 + h (n+1) xs
  | otherwise = 0
 
k xs = maximum [h n xs | n <- [0 .. (length xs)]]