fun main(args: Array<String>) {
    agc040a()
}

fun agc040a() {
    val s = readLine()!!.map { it == '<' }.toBooleanArray()

    var left = 0
    var right = 1
    val numbers = LongArray(s.size + 1) { 0 }

    while (left <= s.lastIndex) {
        while (right <= s.lastIndex && s[left] == s[right]) right++
        if (s[left]) {
            (left..right).withIndex().forEach {
                numbers[it.value] = Math.max(it.index.toLong(), numbers[it.value])
            }
        } else {
            (right downTo left).withIndex().forEach {
                numbers[it.value] = Math.max(it.index.toLong(), numbers[it.value])
            }
        }
        left = right
    }

    println(numbers.sum())
}
