import java.util.Scanner;
public class pedu62B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            String str=sc.next();
            int ans=0;
            if (str.charAt(0)=='<'&& str.charAt(n-1)=='>') {
                ans = n + 1;
                int j = 0;
                while (j < n && str.charAt(j) == '>')
                    j++;
                ans = Math.max(ans, j);
                j = n - 1;
                while (j >= 0 && str.charAt(j) != '<') j--;
                ans = Math.min(ans, n - j - 1);
            }
            System.out.println(ans);
        }
    }
}