S = gets.chomp.chars
n = Array.new(5 * (10 ** 5)) { nil }

n[0] = 0
(0..n.size.pred).each do |i|
  prev = i.zero? ? 0 : n[i]

  n[i.next] =
    case S[i]
    when ?<
      prev < 0 ? 1 : prev.next
    when ?>
      prev > 0 ? 0 : prev.pred
    else
      nil
    end
end

(0..n.size.pred).each do |i|
  prev = n[-i]

  n[-i.next] =
    case S[-i]
    when ?<
      prev < 0 ? 1 : prev.next
    when ?>
      prev > 0 ? 0 : prev.pred
    else
      nil
    end
end

n = n.compact
sum = n.map(&:abs).reduce(:+)
puts sum
