fun main(args: Array<String>) {
    val s = readLine() ?: return
    val l = s.length
    val v = Array(l + 1) { 0L }

    var current = s[0]
    var count = 1
    1.until(l).forEach { i ->
        val c = s[i]
        when (current) {
            '<' -> {
                if (c == '>') {
                    (count).downTo(0).forEach {
                        v[i - it] = Math.max(v[i - it], (count - it).toLong())
                    }
                    current = c
                    count = 1
                } else {
                    count++
                }
            }
            '>' -> {
                if (c == '<') {
                    (count).downTo(0).forEach {
                        v[i - it] = Math.max(v[i - it], it.toLong())
                    }
                    current = c
                    count = 1
                } else {
                    count++
                }
            }
        }
    }
    if (s.last() == '>') {
        (count).downTo(0).forEach {
            v[l - it] = Math.max(v[l - it], it.toLong())
        }
    } else {
        (count).downTo(0).forEach {
            v[l - it] = Math.max(v[l - it], count - it.toLong())
        }
    }
    println(v.sum().toString())
}
