main :: IO()
main = do
  str <- getLine
  putStrLn $ solve str

solve :: String -> String
solve str = show.snd $ foldl f (0,0) str
  where
    f :: (Int, Int) -> Char -> (Int, Int)
    f (x,m) 'I' = (x+1, max m x+1)
    f (x,m) 'D' = (x-1,  m)
