import java.util.Scanner;

public class Runner {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        for (int i = 0; i < n; ++i) {
            int k = sc.nextInt();
            final String str = sc.next();
            int result = 0;

            if (k > 1 && str.charAt(0) == '<' && str.charAt(k - 1) == '>') {
                int lastLeft = 0;
                int firstRight = k - 1;
                for (int l = 0; l < k; ++l) {
                    if (str.charAt(l) == '<') {
                        lastLeft = l;
                    }
                    if (firstRight == k - 1 && str.charAt(l) == '>') {
                        firstRight = l;
                    }
                }

                result = Math.min(k - (lastLeft + 1), firstRight  + 1);
            }

            System.out.println(result);
        }
    }
}