import java.util.*;
public class F {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0){
			int n = sc.nextInt();
			String input = sc.next();
			// > ��k�� <�奪��  
			//�̫�@��>�����ʧ@ �a�@��<�����ʧ@
			//��X�� �i�ۦ�ާ@
			int times1 = 0;
			int kill_right_pos = 0;
			boolean becomebig = true;//�ܦ� >>>>>>>>
			int small = 0;
			int big = 0;
			int firstbig = 0;
			int lastsmall = 0;
			for(int i = 0 ; i<input.length(); i++){
				if(input.charAt(i) == '>'){
					if(firstbig == 0) firstbig = i;
					big++;
				}
				else{
					small++;
					lastsmall = i;
				}
			}
			if(input.charAt(0) == '<' && input.charAt(input.length()-1) == '>'){
				System.out.println(firstbig<= input.length()-lastsmall ? firstbig : input.length()-lastsmall);
			//	System.out.println(small<=big ? small : big);
			}
			else{
				System.out.println('0');
			}
		}
	}
}
