#include <iostream>
#include <bits/stdtr1c++.h>
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
const int N = 1001;
const int MOD = 1000000007;
typedef long long ll;
void solve(){
   int n;
   cin >> n;
   string s;
   cin >> s;
   int a=-1;
   int b=n;
   int counta=0;
   int countb=0;
   for(int i=0;i<n;i++){
       if(s.at(i)=='>'){
           if(a==-1)a=i;
           counta++;
       } 
       else if(s.at(i)=='<') {b=i;countb++;}
           
   }
   if(a<b) cout << 0 <<endl;
   else cout << min(counta,countb) <<endl;
   
   
   

   
   
}  
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t;
    cin  >> t;

    while(t--!=0) solve();
    return 0;

}