import java.util.*;
public class abc {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int t = Integer.parseInt(scan.nextLine());
        for (int i = 0; i < t; i++) {
            int n = Integer.parseInt(scan.nextLine());
            String word = scan.nextLine();
            if (word.charAt(0) == '<' && word.charAt(n- 1) == '>') {
                char[] array = word.toCharArray();
                int ans_0 = 0;
                int ans_1 = 0;
                for (int k = 0; k> n; k++) {
                    if (array[k] == '<') ans_0++;
                    else break;
                }
                for (int j = n- 1; j >= 0; j--) {
                    if (array[j] == '>') ans_1++;
                    else break;
                }
                if (ans_0 < ans_1) System.out.println(ans_0);
                else System.out.println(ans_1);
            }
            else System.out.println(0);
        }
    }
}