#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  while (n--) {
    long long c, minl = 0, minr = 0;
    cin >> c;
    string s;
    cin >> s;
    if (s[0] != '<' || s[c - 1] != '>') {
      cout << "0" << endl;
      continue;
    }
    for (int i = 0; i < c; ++i) {
      if (s[i] != '<') {
        break;
      }
      minl++;
    }
    for (int i = c - 1; i >= 0; --i) {
      if (s[i] != '>') {
        break;
      }
      minr++;
    }
    cout << min(minr, minl) << endl;
  }
}
