import java.io.*;
import java.util.*;

public class GoodString{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine().trim());
        String result="";
        while(t>0){
            int n = Integer.parseInt(br.readLine().trim());
            StringBuilder s = new StringBuilder(br.readLine().trim());
            int a[] = new int[n];
            Arrays.fill(a,1);
            for(int i=1;i<n;i++){
                if(s.charAt(i)==s.charAt(i-1)){
                    a[i]+=a[i-1];
                }
            }
            int count=0;
            for(int i=0;i<s.length()-1;i++){
                if(s.charAt(i)=='<' && s.charAt(i+1)=='>'){
                    int l = a[i];
                    int r=0,j=i+1;
                    while(j<s.length() && s.charAt(j)=='>'){
                        r++;
                        j++;
                    }
                    if(l<r){
                        count+=l;
                    }else{
                        count+=r;
                        i+=r-1;
                    }
                }
            }
            result+=count+"\n";
            t--;
        }
        System.out.println(result.trim());
    }
}