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