import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(in.readLine());
		for (int y = 0; y < t; y++) {
			int n = Integer.parseInt(in.readLine());
			String s = in.readLine();
			
			int i =0;
			while(i < s.length() && s.charAt(i) != '>') {
				i++;
			}
			if(i > 0) {
				int min = i;
				i =s.length()-1;
				while(i > -1 && s.charAt(i) != '<') {
					i--;
				}
				if(i < s.length()-1) {
					System.out.println(Math.min(min, s.length()-i));
				}else
					System.out.println(0);
				continue;
			}else {
				System.out.println(0);
				continue;
			}
		}
	}

}
