#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int g = 0; g < t; g++) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    long long int lc = 0, rc = 0;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << "0" << endl;
      continue;
    }
    for (long long int i = 0; i < n; i++) {
      if (s[i] == '<')
        lc++;
      else
        break;
    }
    for (int i = n - 1; i >= 0; i++) {
      if (s[i] == '>')
        rc++;
      else
        break;
    }
    cout << (lc > rc ? rc : lc) << endl;
  }
}
