import Data.List

main :: IO ()
main = do
  l1 <- getLine
  let s1 = l1
  print $ f s1 0

f [] n = 0
f "<" n = n + n + 1
f ">" n = n
f ('<':s) n = n + f s (n+1)
f s@('>':_) n = g (m - 1) + (max n m) + f s' 0
  where (l, s') = span (=='>') s
        m = length l

g n = (n*(n+1))`div`2