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