program sample
    implicit none
    character(500000)::s
    integer(8) :: i,j,m,n,a,b,c
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    n=len_trim(s)
    a=1
    m=0
    b=0
    do i=1,n-1
        
        if (s(i:i)==s(i+1:i+1))then
            a=a+1
            
        else
            m=m+a*(a-1)/2
            if (s(i:i) .eq. '<')then
                 !頂上はまだ
                b=a
            else
                if (a>b)then
                    m=m+a
                else
                    m=m+b
                end if
            end if
        a=1
        end if
    enddo
    if (s(n:n) .eq. '<')then
       m=m+a*(a+1)/2
    else
        m=m+a*(a-1)/2
       if (a>b)then
           m=m+a
       else
           m=m+b
       end if
   end if


    write(*,*) m
  
    stop
end program sample
  

