//package march19;
import java.util.*;
public class GoodString {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		/*3
2
<>
3
><<
1
>
*/
			Scanner scn=new Scanner(System.in);
			
			int t=scn.nextInt();
			while(t-->0)
			{
				Queue<Character> q=new LinkedList<>();
				int l=scn.nextInt();
				String x=scn.next();
				int count=0;
				if(x.charAt(0)=='>')
				{
					System.out.println("0");
					continue;
				}
				
				else
				{
					for(int i=0; i<x.length(); i++)
					{
						q.add(x.charAt(i));
					}
					for(int i=0; i<x.length(); i++)
					{
						if(x.charAt(i)=='<')
						{
							count=i;
						
						}
						else
						{
							break;
						}
					}
					if(count!=x.length()-1)
					{
						System.out.println(count+1);
					}
					else
					{
						System.out.println(count);
					}
					
					
				}
				
			}

	}

}