// No sorceries shall prevail. //           
import java.util.*;
import java.io.*;
	
public class InVoker {	
	
	static long mod = 1000000007;
	static long gcd(long a,long b) {
		if(b==0)
			return a;
		else 
			return gcd(b,a%b);
	}
	public static void main(String args[]) {
			
		Scanner inp=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		int t=inp.nextInt();
		while(t-->0) {
			int n=inp.nextInt();
			String s=inp.next();
			boolean notPossible = s.charAt(0)=='<';
			notPossible=notPossible && s.charAt(n-1)=='>';
			int diff=0;
			for(int i=0;i<n-1;i++) {
				if(s.charAt(i)!=s.charAt(i+1))
					diff++;
			}
			notPossible=notPossible&&diff<2;
			if(notPossible) {
				int c=1;
				for(int i=0;i<n-1;i++) {
					if(s.charAt(i)!=s.charAt(i+1))
						break;
					c++;
				}
				out.println(Math.min(c, n-c));
			}
			else {
				out.println(0);
			}
		}
		out.close();
		inp.close();
	}
}
