fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()

    var sum = 0L
    var cnt = 1L
    var max = 1L
    var change = 0
    for (i in 1 until s.size) {
        when {
            s[i] == s[i-1] && s[i] == '>'-> {
                max += 1L
            }
            s[i] != s[i-1] && s[i] == '>' -> {
                sum += cnt * (cnt + 1L) / 2L
                max = 1L
                change += 1
            }
            s[i] == s[i-1] && s[i] == '<' -> {
                cnt += 1L
            }
            s[i] != s[i-1] && s[i] == '<' -> {
                sum += max * (max + 1L) / 2L
                if (change > 0) {
                    sum -= if (max > cnt) cnt else max
                }
                cnt = 1L
                change += 1
            }
        }
    }
    if (s.last() == '>') {
        sum += max * (max + 1L) / 2L
        if (change > 0) {
            sum -= if (max > cnt) cnt else max
        }
    } else {
        sum += cnt * (cnt + 1L) / 2L
    }
    println(sum)
}