s = gets.chomp
n = s.size

sum = 0
i = 0
a = 0
stack = []
while i < n
  b =
    if s[i] == '<'
      stack << [i, a, sum]
      a + 1
    else
      a - 1
    end
  sum += b
  i += 1
  a = b
  if b < 0
    i = stack_i.pop
    i, a, sum = stack.pop
    b = a + 1 - b
    sum += b
    i += 1
    a = b
  end
end

puts sum