s = gets.chomp.chars
a = Array.new(s.size + 1, 0)

cnt = 0
s.chunk{|c| c }.each do |c, items|
  l = items.length
  if c == "<"
    a[cnt] = 0
    1.step(l) do |i|
      a[cnt + i] = a[cnt] + i
    end
  else
    a[cnt + l] = 0
    a[cnt] = [l, a[cnt]].max

    1.step(l) do |i|
      a[cnt + l - i] = [a[cnt + l] + i, a[cnt + l - i]].max
    end
  end
  cnt += l
end

#p s.chunk{|c| c }.map{|c, items| [c, items.length] }
#p a
puts a.inject(:+)
# [0, 3, 2, 1, 0, 1, 2, 0, 1, 2, 3, 4, 5, 2, 1, 0, 1]