! 2019.11.4
!
      program answer
      implicit none
      character(len=499999) :: S
      integer(8) :: N_1
      integer(8),dimension(499999) :: counting
      integer(8) :: co
      integer(8) :: i
      integer(8) :: ans
      integer(8),external :: sumsq
      intrinsic len_trim,mod
!
      read(*,*) S
      N_1 = len_trim(S)
! initialization
      do i=1,N_1+1
        counting(i) = 1
      end do
      co = 1
      ans = 0
!
      do i=1,N_1
        if(S(i:i) == S((i+1):(i+1))) then
          counting(co) = counting(co) + 1
        else
          co = co+1
        end if
      end do
      co = co-1
!      write(*,*) (counting(i),i=1,co)
!
      if( S(1:1) == '<') then
        do i=1,co
          if(mod(i,2) == 0) then
          else
            if(counting(i) < counting(i+1)) then
              counting(i) = counting(i) - 1
            else
              counting(i+1) = counting(i+1) - 1
            end if
          end if
        end do
      else
        do i=1,co
          if(mod(i,2) == 1) then
            if(i == 1) then
              counting(i) = counting(i) - 1
            end if
          else
            if(counting(i) < counting(i+1)) then
              counting(i) = counting(i) - 1
            else
              counting(i+1) = counting(i+1) - 1
            end if
          end if
        end do
      end if
!
!      write(*,*) (counting(i),i=1,co)
      do i=1,co
        ans = ans + sumsq(counting(i))
      end do
!
      write(*,*) ans
      end program answer
!
      function sumsq(A) result(res)
      implicit none
      integer(8) :: A,res
      res = A*(A+1)/2
      end function sumsq