#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
void solve() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long idx = 0, idx1 = n - 1;
    while (idx < n && s[idx] != '>') {
      ++idx;
    }
    while (idx1 >= 0 && s[idx1] != '<') {
      --idx1;
    }
    cout << min(idx, n - 1 - idx1) << "\n";
  }
}
int32_t main() {
  bool testing = false;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (testing) {
    freopen("test1.txt", "rt", stdin);
    long long start = clock();
    solve();
    long long end = clock();
    cout << "time: " << (end - start) / (double)(CLOCKS_PER_SEC)*1000
         << " milliseconds\n";
  } else {
    solve();
  }
}
