program name
    implicit none
    integer(8),allocatable:: a(:)
    character(500000):: s
    integer(4):: n,i

    read*, s(:)
    n=len_trim(s)+1
    allocate(a(n))
    a(:) = 0
    do i=1,n-1
        if (s(i:i) == '<') a(i+1) = a(i)+1
    end do

    do i=n-1,1,-1
        if (s(i:i) == '>' .and. a(i) <= a(i+1)) a(i) = a(i+1)+1
    end do
    print*, sum(a)
end program name