program prob3
    implicit none
    character(len=500005) :: s
    integer(8) :: n, i, tmp
    integer(8) , allocatable :: a(:)

    read(*,*) s
    n = len_trim(s) + 1

    allocate(a(n))

    tmp = 0
    a(1) = 0
    do i = 1, n-1
        if(s(i:i) == '<') then
            tmp = tmp + 1
            a(i+1) = tmp
        else
            tmp = 0
            a(i+1) = tmp
        end if
    end do

    a(n) = max(a(n), 0)
    tmp = 0
    do i = n-1, 1, -1
        if(s(i:i) == '>') then
            tmp = tmp + 1
            a(i) = max(a(i), tmp)
        else
            tmp = 0
            a(i) = max(a(i), tmp)
        end if
    end do

    write(*,*) sum(a)


    deallocate(a)
    stop
contains
end program prob3