import java.util.*;
public class asd
{
         public static void main(String argsg[])
         {
                  Scanner s=new Scanner(System.in);
                  int t=s.nextInt();
                  while(t-->0)
                  {
                      int n=s.nextInt();
                      String str=s.next();
                      if(str.charAt(0)=='>'||str.charAt(str.length()-1)=='<')
                          System.out.println("0");
                      else
                      {
                          int count1=0;
                          int count2=0;
                          for(int i=0;i<str.length();i++)
                          {          if(str.charAt(i)=='>')
                          { count1++;break;}
                          }
                          for(int i=n-1;i>=0;i--)
                          {          if(str.charAt(i)=='<')
                          {  count2++;break;}
                          }
                          System.out.println(Math.min(count1,count2));
                       }
                  }
           
    }
}