program prob5
    implicit none
    integer(8) i, L, m, change, up, down, j, ans
    integer(8), allocatable::s(:)
    character(len=5*10**5) N
    read(*,*) N
    L = len_trim(N)
    allocate(s(L+1))
    s = 0
    change = 0
    up = 0
    down = 0
    ans = 0

    do i = 1, L
        if(N(i:i) .eq. ">")then
            down = down + 1
            ans = ans + down
            s(i+1) = 0
            if((N(i+1:i+1) .eq. "<") .or. i == L)then
                if(s(i - down + 1) >= down)then
                    ans = ans - down
                else
                    ans = ans - up
                end if
                up = 0
            end if
        else
            up = up + 1
            ans = ans + up
            s(i+1) = s(i) + 1
            if(N(i+1:i+1) .eq. ">")then
                down = 0
            end if
        end if

    end do
    write(*,*) ans

    deallocate(s)

    stop
end program prob5