import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);
		int n = scan.nextInt();
		for(int i=0;i<n;i++){
	    int x = scan.nextInt();
	    String str = scan.next();
	    int front = 0;
	    int back = 0;
	    for(int j=0;j<x;j++){
	        if(str.charAt(j)=='>'){
	            front=j;
	            break;
	        }
	    }
	    for(int j=x-1;j>0;j--){
	        if(str.charAt(j)=='<'){
	            back=x-1-j;
	            break;
	        }
	    }
	    //System.out.println("F " + front + " B " + back);
	    if(str.length()==1){
	        System.out.println(0);
	        return;
	    }
	    if(str.startsWith(">")||str.endsWith("<")){
	           System.out.println(0);
	        }else{
	           System.out.println(Math.min(Math.max(front, 1), Math.max(back, 1)));
	        }
		}
	}
}
