import Control.Arrow

main :: IO ()
main = print . solve =<< getLine

solve :: String -> Int
solve = iter 0 0 . runlen
  where
    iter s _ [] = s
    iter s _ (('<',n) : rs) = iter (s + n * succ n `div` 2) n rs
    iter s m (('>',n) : rs) = iter (s + s') 0 rs
      where
        s' = n * pred n `div` 2 + if m < n then n - m else 0
        
runlen :: String -> [(Char, Int)]
runlen ""     = []
runlen (c:cs) = case spanCount (c ==) cs of
  (m, rs) -> (c, succ m) : runlen rs

spanCount :: (a -> Bool) -> [a] -> (Int, [a])
spanCount _ [] = (0, [])
spanCount p xxs@(x:xs) 
  | p x       = first succ $ spanCount p xs
  | otherwise = (0, xxs)
