import java.util.*;

public class helloWorld 
{
	static int k1, k2, mod = 100000000;
	static int[][][][] dn;
	public static void main(String[] args) 
	{		
		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		
		StringBuilder ans = new StringBuilder();
		for(; t > 0; t--) {
			int n = in.nextInt();
			String str = in.next();
			int a = 0, b = n-1;
			if(str.charAt(0) == '<' && str.charAt(n-1) == '>') {
				for(; a < n && str.charAt(a) == '<'; a++);
				for(; b >=0 && str.charAt(b) == '>'; b--);
				a = Math.min(a+1, n-b-1);
			}
			ans.append(a + "\n");
		}
		
		System.out.println(ans);

		in.close();
	}
}

/*
<<<<<<><><><>>>>>>>>>
<<<>>>>>
*/

