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