import java.io.BufferedInputStream;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(new BufferedInputStream(System.in));
	static int t;

	public static void main(String[] args) {
		t = scan.nextInt();
		for (int i = 0; i < t; i++) {
			int n = scan.nextInt();
			char[] temp = scan.next().toCharArray();
			LinkedList<Character> list = new LinkedList<>();
			for (int j = 0; j < temp.length; j++) {
				list.add(temp[j]);
			}
			System.out.println(fun(list));
		}
	}

	static int fun(LinkedList<Character> list) {
		LinkedList<Character> listcopy = (LinkedList<Character>) list.clone();
		int min = Integer.MAX_VALUE;
		int count = 0;
		listcopy.add(' ');
		for (int i = 0; i < listcopy.size() - 1;) {
			if (!listcopy.get(i).equals('<')) {
				if (listcopy.get(i + 1).equals('<')) {
					listcopy.set(i, '<');
					i++;
				} else {
					listcopy.remove(i);
					count++;
				}
			} else {
				i++;
			}
		}
//		 System.out.println(count);
		min = Math.min(min, count);
		count = 0;
		list.addFirst(' ');
		for (int i = 1; i < list.size();) {
			if (!list.get(i).equals('>') ) {
				if (list.get(i - 1).equals('>')) {
					list.set(i, '>');
					i++;
				} else {
					list.remove(i);
					count++;
				}
			} else {
				i++;
			}
		}
//		 System.out.println(count);
		min = Math.min(min, count);
		return min;
	}
}
