import java.io.*;
import java.util.*;

public class B{

	static StringBuilder st = new StringBuilder();
	
	public static void main(String[] args) throws Exception 
	{
		Scanner sc = new Scanner(System.in) ; 
		PrintWriter out = new PrintWriter(System.out) ; 
		
		int t = sc.nextInt() ; 
		
		while(t -->0)
		{
			int n = sc.nextInt() ; 
			
			char []  s = sc.next().toCharArray() ; 
			
			int lst1 = 0 ; int lst2 = 0 ;
			
			for(int i = 0 ;i < n ;i++)
				if(s[i] == '>')
				{
					lst1 = i ; 
					break ; 
				}
			for(int i = n - 1 ; i >= 0 ; i--)
				if(s[i] == '<')
				{
					lst2 = n - i ; 
					break ; 
				}
			out.println(Math.min(lst1, lst2));
					
		}
		
		
		out.flush();
		out.close(); 
	}
	
	static class Scanner 
	{
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream in) 
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws Exception 
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		int nextInt() throws Exception { return Integer.parseInt(next()); }

		long nextLong() throws Exception { return Long.parseLong(next()); }

		double nextDouble() throws Exception { return Double.parseDouble(next());}

	}
	
	static void shuffle(int[] a) 
	{
		for (int i = 0; i < a.length; i++) 
		{
			int r = i + (int) (Math.random() * (a.length - i)) , tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}
}