
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0) {
            int n = sc.nextInt();
            String s = sc.next();
            int count = 0;
            String sub = "";
            for(int i=0; i<n; i++) {
                if(s.charAt(i) == '>') {
                    s = s.substring(0, i+1);
                    break;
                }
            }
            for(int i=s.length()-1; i>=0; i--) {
                if(s.charAt(i) == '<') {
                    s = s.substring(i);
                    break;
                }
            }
			System.out.println(s.length()-1 >=1 ? s.length()-1 : "0");

        }
    }
    
}
