import Control.Arrow

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

solve :: String -> Int
solve = iter 0 . runlen
  where
    iter s []               = s
    iter s (('>',m):[])     = s + m*(m-1)`div`2
    iter s ((_,m):[])       = s + m*(m+1)`div`2
    iter s (('>',m):rs)     = iter (s + m*(m-1)`div`2) rs
    iter s ((_,m):(_,n):rs) = iter (s+s') rs
      where
        s' = if m > n then m*(m+1)`div`2 + n*(n-1)`div`2
             else m*(m-1)`div`2 + n*(n+1)`div`2
        
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)