import java.util.*;
import java.io.*;
public class Good_String {

	public static void main(String[] args) throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			int n=Integer.parseInt(br.readLine());
			String s=br.readLine();
			int c=0,open=0,close=0;
			for(int i=0; i<s.length(); i++) {
				if(s.charAt(i)=='<') {++c;++open;}
				else {
					++close;
					if(c>0) --c;
				}
			}
			if(open!=close) System.out.println(0);
			else {
				System.out.println(c==0?1:open);
			}
		}
	}

}
