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.

Constraints

* 2 \leq N \leq 5 \times 10^5
* S is a string of length N-1 consisting of `<` and `>`.

Input

Input is given from Standard Input in the following format:


S


Output

Find the minimum possible sum of the elements of a good sequence of N non-negative integers.

Examples

Input

<>>


Output

3


Input

<>>><<><<<<<>>><


Output

28
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fucking interest
*******************************
Higher, higher, even higher, to the point you won’t even be able to see me
https://www.a2oj.com/Ladder16.html
*******************************
NEVER DO 300IQ CONTESTS EVER
300IQ AS WRITER = EXTRA NONO
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         char[] input = infile.readLine().toCharArray();
         int N = input.length;
         int[] arr = new int[N+1];
         Arrays.fill(arr, -1);
         if(input[0] == '<')
            arr[0] = 0;
         if(input[N-1] == '>')
            arr[N] = 0;
         for(int i=1; i <= N-1; i++)
            if(input[i-1] == '>' && input[i] == '<')
               arr[i] = 0;
         for(int i=1; i <= N-1; i++)
            if(input[i-1] == '<' && input[i] == '>')
            {
               int left = i;
               while(arr[left] != 0)
                  left--;
               int right = i;
               while(arr[right] != 0)
                  right++;
               int temp = 1;
               for(int a=left+1; a < i; a++)
                  arr[a] = temp++;
               temp = 1;
               for(int a=right-1; a > i; a--)
                  arr[a] = temp++;
               arr[i] = Math.max(arr[i-1],arr[i+1])+1;
            }
         for(int i=0; i <= N; i++)
            if(arr[i] == 0)
            {
               int dex = i-1;
               while(dex >= 0 && arr[dex] < 0)
               {
                  arr[dex] = arr[dex+1]+1;
                  dex--;
               }
               dex = i+1;
               while(dex <= N && arr[dex] < 0)
               {
                  arr[dex] = arr[dex-1]+1;
                  dex++;
               }
            }
         long res = 0L;
         for(int x: arr)
            res += x;
         System.out.println(res);
      }
   }