object Main extends App {
  val sc = new java.util.Scanner(System.in)

  @scala.annotation.tailrec
  def loop(chars: Seq[Char], acc: List[(Int, Int)]): Seq[(Int, Int)] = {
    if (chars.isEmpty) {
      acc.reverse
    } else {
      val (l, xs) = chars.span(_ == '<')
      val (r, xs2) = xs.span(_ == '>')
      loop(xs2, (l.length, r.length) :: acc)
    }
  }

  val steps = (1 to 500000).scanLeft(0L)(_ + _).toArray
  val chars@x :: _ = sc.next().toCharArray.toList
  println {
    loop(if (x == '>') '>' :: chars else chars, List.empty).map {
      case (l, r) if 0 < l && l < r => steps(l - 1) + steps(r)
      case (l, r) => steps(l) + steps(0.max(r - 1))
    }.sum
  }
}
