#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll> 

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow1(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }
    
    return a.first<b.first;
}

#define N 200010

int a[10010];

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int t,n,i,f;
	cin>>t;
	
	string s;
	while(t--){
	    f=0;
	    cin>>n>>s;
	    
	    if(s[0]=='>'||s[n-1]=='<'){
	        cout<<"0\n";
	        continue;
	    }
	    
	    for(i=0;i<n-1;i++){
	        if(s[i]=='<'&&s[i+1]=='>'){
	            break;
	        }
	    }
	    
	    if(i==n-1) cout<<"0\n";
	    else cout<<min(i+1,n-i-1)<<"\n";
	    
	}
	
    return 0;
}