Imports System.Collections.Generic

Module Module1

sub Main(ByVal args() as String)
    dim S as string = Console.ReadLine()
    dim queue as new List(Of uinteger)()
    dim rueue as new List(Of uinteger)()

    for i as uinteger=0 to S.length()-1
        if S.substring(i, 1)=">" then
            queue.add(1)
        else
            queue.add(0)
        end if
    next i

    dim old as uinteger = 0
    dim sum as uinteger = 0
    While queue.count>0
        While queue.count>0 andalso (rueue.count=0 orelse rueue(0)=queue(0))
            rueue.add(queue(0))
            queue.removeAt(0)
        end While
        if rueue(0)="1" then
            if old<rueue.count then
                sum -= old
            else
                sum -= rueue.count
            end if
        else
            old = rueue.count
        end if
        sum += func1(rueue.count)
        rueue.clear()
    End While

    Console.WriteLine(sum)
end sub

function func1 (ByVal n as uinteger) as uinteger
    if n>1 then
        func1 = n + func1(n-1)
    else
        func1 = 1
    end if
end function
end Module