#include <bits/stdc++.h>
using namespace std;
int main() {
  int m;
  int n, k = 0, k1 = 0, k0 = 0, sm = 0, nm = 0, sm_original = 0, f = 0, mx = 0,
         t;
  char c;
  string s;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    int mn = s.size() - 1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>' || s[n - 1 - i] == '<') mn = min(mn, i);
    }
    cout << mn << endl;
  }
  return 0;
}
