
import java.util.Scanner;

public class Goodstring {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int test = in.nextInt();
        for(int t=0;t<test;t++){
            int n=in.nextInt();
            String str = in.next();

            int firstOcc=-1 ;
            for(int i=0;i<n;i++){
                if(str.charAt(i) == '>') {
                    firstOcc = i;
                    break;
                }
            }

            if(firstOcc==-1 || firstOcc ==0)
                System.out.println(0);
            else{
                int lastOcc=-1;
                for(int i=0;i<n;i++){
                    if(str.charAt(i)=='<'){
                        lastOcc=i;
                    }
                }

                if(lastOcc < firstOcc)
                    System.out.println(lastOcc+1);
                else
                    System.out.println(firstOcc+1);
            }
        }
    }
}
