import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class nB {

	public void run() throws NumberFormatException, IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		int n = nextInt();
		for (int i = 0; i < n; i++) {
			int m = nextInt();
			char[] c = br.readLine().toCharArray();
			int x = 0;
			for(int j = 0; j < c.length; j++) {
				if(c[j] == '>') {
					x = j;
				}
			}
			for(int j = c.length - 1; j >= 0; j--) {
				if(c[j] == '<') {
					x = Math.min(x, c.length - 1 - j);
				}
			}
			pw.println(x);
		}
		pw.close();
	}

	StringTokenizer st;
	BufferedReader br;
	PrintWriter pw;

	public static void main(String[] args) throws IOException {
		new nB().run();
	}

	public String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

	public int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

}
