solve s = h s 0 0
          where h [] _ m = show m
                h (c:cs) n m = case c of
                                 'I' -> h cs (n+1) (max (n+1) m)
                                 'D' -> h cs (n-1) m

main = do getLine
          s <- getLine
          putStrLn $ solve s
