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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemA_MoreLess solver = new ProblemA_MoreLess();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemA_MoreLess {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            int n = s.length;
            int[] l = new int[n];
            int[] r = new int[n];
            for (int i = 0; i < n; i++) {
                if (s[i] == '<') {
                    l[i] = 1;
                    if (i > 0) {
                        l[i] += l[i - 1];
                    }
                }
            }
            for (int i = n - 1; i >= 0; i--) {
                if (s[i] == '>') {
                    r[i] = 1;
                    if (i + 1 < n) {
                        r[i] += r[i + 1];
                    }
                }
            }
            long ans = r[0] + l[n - 1];
            for (int i = 0; i + 1 < n; i++) {
                ans += Math.max(l[i], r[i + 1]);
            }
            out.println(ans);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}

