#include <bits/stdc++.h>
using namespace std;
vector<char> v(100000000 + 1, true);
void sieve() {
  v[0] = v[1] = false;
  long long k = 0;
  for (long long i = 2; i * i <= 100000000; i++)
    if (v[i]) {
      for (long long j = i * i; j <= 100000000; j += i) v[j] = false;
    }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, lc = 0, rc = 0;
    string s;
    cin >> n >> s;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '>') {
        break;
      } else {
        lc++;
      }
    }
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] == '<') {
        break;
      } else {
        rc++;
      }
    }
    cout << min(lc, rc) << '\n';
  }
}
