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: ##https://atcoder.jp/contests/agc040/tasks/agc040_a
  
  
  def find_next_lt_pos(start, s, n):
      for i in range(start, n):
          if s[i] == "<":
              return i
      return -1
  
  
  def find_next_gt_pos(start, s, n):
      for i in range(start, n):
          if s[i] == ">":
              return i
      return -1
  
  
  def sum_to_n(n):
      return n * (n + 1) // 2
  
  
  def same_symbol_len(symb, st_pos, s):
      sp = st_pos
      while s[sp] == symb:
          sp += 1
      return sp
  
  
  def find_sum(s):
      n = len(s)
      a = [0] * (n + 1)
  
      cur_pos = 0
      change_pos = find_next_lt_pos(0, s, n)
      if change_pos == -1:
          for i in range(n + 1):
              a[i] = n - i
      else:
          for i in range(cur_pos, change_pos + 1):
              a[i] = change_pos - i
          cur_pos = change_pos + 1
  
          while cur_pos <= n:
              change_pos = find_next_gt_pos(cur_pos, s, n)
              if change_pos == -1:
                  for i in range(cur_pos, n + 1):
                      a[i] = i - cur_pos + 1
                  cur_pos = n + 1
              else:
                  change_pos_2 = find_next_lt_pos(change_pos, s, n)
                  if change_pos_2 == -1:
                      change_pos_2 = n
                  for i in range(cur_pos, change_pos + 1):
                      a[i] = 1 + i - cur_pos
  
                  cur_pos = change_pos
                  for i in range(cur_pos, change_pos_2 + 1):
                      if change_pos_2 - i > a[i]:
                          a[i] = change_pos_2 - i
                  cur_pos = change_pos_2 + 1
  
          return sum(a)
  
  
  def solve():
      print(find_sum(input()))
  
  
  if __name__ == "__main__":
      solve()
  
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"}]