#include <bits/stdc++.h>
using namespace std;
int fx[4] = {1, -1, 0, 0};
int fy[4] = {0, 0, 1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9 + 7;
const int maxn = (int)2e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int F = 0, L = 0;
    for (int i = 0; i < (int)s.size(); i++) {
      if (s[i] == '<') {
        F++;
      } else
        break;
    }
    for (int i = (int)s.size() - 1; i >= 0; i--) {
      if (s[i] == '>') {
        L++;
      } else
        break;
    }
    cout << min(F, L) << endl;
  }
  return 0;
}
