output_description: Find the minimum possible sum of the elements of a good sequence of N non-
  negative integers.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: #!/usr/bin/env python3
  # Atcoder necoak answer
  # https://atcoder.jp/contests/agc040/tasks/agc040_a
  
  MAX_INT = 100000
  s_txt = input()
  
  MIN_V = 1000000
  
  
  def func(my_suretu, my_s_txt, min_v):
      # print('func(', my_suretu, my_s_txt, min_v, ')')
  
      now_sum = sum(my_suretu)
      # print(now_sum)
      if now_sum >= min_v:
          return min_v
  
      if len(my_s_txt) == 0:
          if now_sum < min_v:
              min_v = now_sum
          return min_v
      else:
          next_my_s_txt = my_s_txt[1:]
  
      for v in range(0, MAX_INT):
          new_min_v = min_v
          if len(my_suretu) == 0:
              new_min_v = func(my_suretu + [v], next_my_s_txt, min_v)
          elif ((my_s_txt[0] == ">") and (my_suretu[-1] > v)) or (
              (my_s_txt[0] == "<") and (my_suretu[-1] < v)
          ):
              # print(my_suretu[-1], my_s_txt[0], v)
              new_min_v = func(my_suretu + [v], next_my_s_txt, min_v)
          if new_min_v < min_v:
              min_v = new_min_v
          elif (new_min_v == min_v) and (new_min_v != MIN_V):
              break
  
      return min_v
  
  
  min_v = MIN_V
  for v in range(0, MAX_INT):
      new_min_v = func([v], s_txt, min_v)
      if new_min_v < min_v:
          min_v = new_min_v
      elif (new_min_v == min_v) and (new_min_v != MIN_V):
          break
  
  print(min_v)
  
problem_description: Statement
  
  Given is a string S of length N-1. Each character in S is `<` or `>`.
  
  A sequence of N non-negative integers, a_1,a_2,\cdots,a_N, is said to be
  _good_ when the following condition is satisfied for all i (1 \leq i \leq
  N-1):
  
    * If S_i= `<`: a_i<a_{i+1}
    * If S_i= `>`: a_i>a_{i+1}
  
  Find the minimum possible sum of the elements of a good sequence of N non-
  negative integers.
samples: [{"input": "<>>", "output": "3\n    \n\na=(0,2,1,0) is a good sequence whose sum is 3. There is no good sequence whose\nsum is less than 3.\n\n* * *"}, {"input": "<>>><<><<<<<>>><", "output": "28"}]