#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using dbl = double;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using mii = map<int, int>;
using msi = map<string, int>;
using umii = unordered_map<int, int>;
using umsi = unordered_map<string, int>;
using iii = tuple<int, int, int>;
using lll = tuple<ll, ll, ll>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) {
  if (!a || !b) return a + b;
  return a * (b / gcd(a, b));
}
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != '<') {
        break;
      }
      a++;
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] != '>') {
        break;
      }
      b++;
    }
    cout << min(a, b) << "\n";
  }
  return 0;
}
