#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int t;
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n;
    cin >> s;
    bool kt = false;
    int mi = 200, cr = 0, r = 0, l = 0;
    for (int j = 0; j < n; j++) {
      if (s[j] == '<' && cr == 0)
        l++;
      else if (s[j] == '<' && r > 0) {
        r = 0;
      }
      if (s[j] == '>' && l == 0) {
        kt = true;
        break;
      } else if (s[j] == '>' && l > 0) {
        r++;
        cr++;
      }
    }
    if (kt == true || r == n || l == n || s[n - 1] == '<') {
      cout << 0 << endl;
    } else {
      cout << min(l, r) << endl;
    }
  }
  return 0;
}
