
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

/*
 * 
 * @author harshpant
 * A tricky question due to the language in which it was specified.
 */

public class GoodString {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		while(t > 0) {
			int len = scanner.nextInt();
			String input = scanner.next();
			System.out.println(Math.min
					(rDistance(input, '>'), lDistance(input, '<')));
			t--;
		}
	
	}
	
	public static int rDistance(String s, char c) {
		int l = s.length();
		int i = 0;
		while(i<s.length() && s.charAt(i)!=c) {
			i++;
		}
		int k = i;
		if(i == s.length()) {
			return i - 1;
		}
		else {
			return i ;
		}
	}
	
	public static int lDistance(String s, char c) {
		int i = s.length() - 1;
		while(i>0 && s.charAt(i)!=c) {
			i--;
		}
		int k = s.length()-i;
		if(i == 0) {
			return s.length()-1;
		}
		else {
			return s.length() - i;
		}
		
	}
	
}
