#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k0, k1;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    k0 = 999;
    k1 = 999;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') {
        k0 = i;
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '<') {
        k1 = n - i - 1;
        break;
      }
    }
    cout << min(k0, k1) << '\n';
  }
  return 0;
}
