#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int l, r;
    int res = n - 1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>' || s[n - 1 - i] == '<') {
        res = min(i, res);
      }
    }
    cout << res << "\n";
  }
  return 0;
}
