import java.util.*;

//Mann Shah [ DAIICT ].

public class Main { 
	
	

	public static void main(String[] Args) {
		Scanner in = new Scanner(System.in);
		int mod = 1000000007;
		
		int T = in.nextInt();
		while(T-->0) {
			int n = in.nextInt();
			in.nextLine();
			String s = in.next();
			int f=0;
			int exit=0;
			int base=0;
			boolean ans=true;
			for(int i=0;i<s.length();i++) {
				if(s.charAt(i)=='<') {
					f=1;
					base =i+1;
				}
				if(s.charAt(i)=='>' && f==1) {
					exit = n-i;
					ans=false;
					break;
				}
			}
			
			System.out.println(Math.min(base, exit));
			
		}
		in.close();	
	}
}