#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  int t;
  cin >> t;
  long long n, a, b;
  string str;
  while (t--) {
    cin >> n;
    cin >> str;
    if (n == 1) {
      cout << "0\n";
    } else {
      a = str.find('>');
      b = str.rfind('<');
      b = n - 1 - b;
      if (a == 0 || b == 0)
        cout << "0\n";
      else
        cout << min(a, b) << endl;
    }
  }
}
