import java.util.Scanner;

public class Test {

    public static int calculate(String str){

        int first = -1;
        int last = -1;

        for (int i = 0; i < str.length(); i++) {
            if(str.charAt(i) == '>') {
                first = i;
                break;
            }
        }

        for (int i = str.length() - 1; i >= 0 ; i--) {
            if(str.charAt(i) == '<') {
                last = str.length() - 1 - i;
                break;
            }
        }

        if(first < 0 || last < 0) return 0;
        else{

            if(first < last) return first + str.length() - 1 - last;
            else return Math.min(first, last);
        }
    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int numOfTestCases = in.nextInt();
        String[] strings = new String[numOfTestCases];
        int length;

        //String string = "><<<>";
        //System.out.println(LeftToRightIndex(string));

        for (int i = 0; i < numOfTestCases; i++) {
            length = in.nextInt();
            strings[i] = in.next();
            System.out.println(calculate(strings[i]));
        }

    }
}
