//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    
    public static void main(String[] args) throws IOException 
    { 
        Scanner input = new Scanner(System.in);
        input.nextInt();
        while(input.hasNext()){
            int n=input.nextInt();
            String s=input.next();
            int left=0;
            int right=0;
            for(int i=0;i<n;i++){
                if(s.charAt(i)=='>'){
                    right=i;
                    break;
                }
            }
            for(int i=n-1;i>=0;i--){
                if(s.charAt(i)=='<'){
                    left=i;
                    break;
                }
            }
            if(s.charAt(0)==s.charAt(n-1)){
                System.out.println(0);
                continue;
            }
            System.out.println(right+n-1-left>=n?n-1:(right+n-1-left));
        }
    }
    
    // Returns value of n! % p 
    static long modFact(int n, 
                       long p) 
    { 
        if (n >= p) 
            return 0; 
      
        long result = 1; 
        for (int i = 1; i <= n; i++) 
            result = (result * i) % p; 
      
        return result; 
    } 
    static boolean isPrime(int n) 
    { 
        // Corner case 
        if (n <= 1) return false; 
      
        // Check from 2 to n-1 
        for (int i = 2; i < n; i++) 
            if (n % i == 0) 
                return false; 
      
        return true; 
    } 
    public static long fac(long n){
        if(n==1){
            return 1;
        }
        return n*fac(n-1);
    }
    
}