#include <algorithm>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>

using namespace std;
using namespace __gnu_pbds;

#ifdef pragma
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC diagnostic ignored "-Wunused-result"
#endif 

typedef long long ll;
typedef pair<ll, ll> pll;

#define ordered_set tree <pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update>
#define f first
#define s second

long long const INF = 1e18, t = 10;

void acceleration () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void formatting () {
	cout << fixed;
	cout.precision(t);
	cout << setprecision(t);
}


int main () {
	acceleration ();
	ll n, t;
	cin >> n;
	string s;
	for (int i = 0 ; i < n ; i++) {
		cin >> t;
		cin >> s;
		ll l = INF, r = INF;
		for (int j = 0 ; j < s.size() ; j++) {
			if (s[j] == '>' && l == INF) l = j; 
			if (s[j] == '<') r = j; 
		}
		if (t == 1) cout << 0 << endl;
		else cout << min(l, (ll)s.size() - r - 1) << endl;
	}
}