#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int l = 0, r = n - 1, x = 0, y = 0;
    while (s[l] == '<') {
      l++;
      x++;
    }
    while (s[r] == '>') {
      r--;
      y++;
    }
    cout << min(x, y) << endl;
    ;
  }
  return 0;
}
