S = []
gets.chomp.chars.slice_when{|a,b| a != b}.each do |v|
  S << [v[0], v.size]
end

def acc(n)
  n*(n+1)/2
end

count = 0

if S[0][0] == ">"
  s = S.shift
  count += acc(s[1])
end

S.each_slice(2) do |a,b|
  if b.nil?
    count += acc(a[1])
    break
  end

  if a[1] < b[1]
    count += acc(a[1]-1)
    count += acc(b[1])
  else
    count += acc(a[1])
    count += acc(b[1]-1)
  end
end

puts count

