str = gets.chomp
a_count = 0
b_count = 0
flag = false
result = 0

str.chars.each do |s|
  if s == "<"
    if flag
      if a_count >= b_count
        result += (a_count + 1) * a_count / 2
        result += (b_count + 1) * b_count / 2 - b_count
      else
        result += (a_count + 1) * a_count / 2 - a_count
        result += (b_count + 1) * b_count / 2
      end

      a_count = 0
      b_count = 0

      flag = false
    end

    a_count += 1
  end

  if s == ">"
    if a_count > 0
      flag = true
    end

    b_count += 1
  end
end

if a_count > 0 || b_count > 0
  if flag
    if a_count >= b_count
      result += (a_count + 1) * a_count / 2
      result += (b_count + 1) * b_count / 2 - b_count
    else
      result += (a_count + 1) * a_count / 2 - a_count
      result += (b_count + 1) * b_count / 2
    end
  else
    result += (a_count + 1) * a_count / 2
    result += (b_count + 1) * b_count / 2
  end
end

puts result