import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int sum = 0;
            char[] q = s.toCharArray();
            for (int i = 0; i < q.length; i++) {
                if (q[i] == '<' && (i + 1 <= q.length - 1) && q[i + 1] == '>') {
                    int left = 0;
                    int x = i;
                    while (x >= 0 && q[x] == '<') {
                        left++;
                        x--;
                    }
                    int right = 0;
                    int y = i + 1;
                    while (y < q.length && q[y] == '>') {
                        right++;
                        y++;
                    }
                    sum = sum + Math.min(left, right);
                }
            }
            out.println(sum);
        }

    }
}

