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


public class test {
	public static void main(String[] args) throws IOException{
		BufferedReader newReader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(newReader.readLine());
		int lefts=0;
		int rights=0;
		int smallest=0;
		for(int i=1;i<=n;i++) {
			int f = Integer.parseInt(newReader.readLine());
			String split[] = newReader.readLine().split("");
			for(int j=0;j<f;j++) {
				if(split[j].equals("<")) lefts++;
				if(split[j].equals(">")) rights++;
				smallest = Math.min(lefts, rights);
			}
			if(f>=3) {
				for(int j=1;j<f;j++) {
					if(split[j].equals("<") && split[j-1].equals(">")) smallest--;
				}
			}
			System.out.println(smallest);
			lefts=0;
			rights=0;
		}
	}
}