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