import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
    
    public static int isGood(String chain) {
        if (chain.startsWith(">")) return 0;
        
        if (chain.endsWith("<")) return 0;
        
        if (Pattern.matches("(<>)+", chain))
            return (chain.length());
        
        return (Math.min(chain.lastIndexOf("<")+1,chain.lastIndexOf(">")-chain.lastIndexOf("<")+2));
        
        
    }
    
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = Integer.valueOf(in.nextLine());
        for (int i=0;i<count;i++) {
            int leng = Integer.valueOf(in.nextLine());
            System.out.println(isGood(in.nextLine()));
        }
        in.close();
        
    }
    
}
