s = gets

count = 0
while str = s.slice!(/<*>*/)
  break if str == ""
  l, r = str.count("<"), str.count(">")
  if l >= r
    count += l * (l+1) / 2
    count += (r-1) * r / 2
  else
    count += r * (r+1) / 2
    count += (l-1) * l / 2
  end
end

puts count