import java.util.Scanner;



public class GoodString {

	public static void main(String[] args) {
		int t;
		Scanner s = new Scanner(System.in);
		t = s.nextInt();
		int l;
		StringStack stringStack;
		
		while(t>0) {
			int lenghtOfIp = s.nextInt();
			String inputString = s.next();
			stringStack = new StringStack(inputString.length());
			for (int i = 0; i < inputString.length(); i++) {
				char c = inputString.charAt(i);
				if(i == 0) {
					stringStack.push(inputString.charAt(i));
				}
				else {
					if(stringStack.top() == '>') {
					}
					else if(c == '<' && !stringStack.isEmpty()) {
						stringStack.pop();
						stringStack.push(c);
					}
					else {
						stringStack.push(c);
					}
				}
			}
			System.out.println(stringStack.stackPointer);
			t--;
		}
		
	}

}


class StringStack {
	char a[];
	int length;
	int stackPointer;
	public StringStack(int l) {
		a = new char[l];
		length = l;
		stackPointer = -1;
	}
	 public StringStack(String s) {
		 a = s.toCharArray();
		 length = a.length;
		 stackPointer = -1;
	 }
	
	boolean isEmpty() {
		if (this.stackPointer == -1) {
			System.out.println("Stack is empty");
			return true;
		}
		else {
			return false;
		}
	}
	
	boolean isFull() {
		if (this.stackPointer == this.length - 1) {
			System.out.println("Stack is full");
			return true;
		}
		else {
			return false;
		}
	}
	
	void push(char c) {
		if(isFull()) {}
		else {
			stackPointer ++;
			a[stackPointer] = c;
		}
	}
	
	char pop() {
		if(isEmpty()) {
			return '?';
		}
		else {
			int k = stackPointer;
			stackPointer --;
			return a[k];
		}
	}
	
	
	int getStackPointer() {
		return stackPointer;
	}
	
	char top() {
		return a[stackPointer];
	}
}

