#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<int> primes;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  int n;
  cin >> n;
  while (n--) {
    int r;
    string x;
    cin >> r >> x;
    if (r == 1) {
      cout << 0;
      continue;
    }
    int t = 0;
    for (int i = 0; i < x.size(); ++i) {
      if (x[i] == '<') {
        t++;
      } else
        break;
    }
    int t1 = 0;
    for (int i = x.size() - 1; i >= 0; ++i) {
      if (x[i] == '>') {
        t1++;
      } else
        break;
    }
    if (t == 0 || t1 == 0) {
      cout << 0;
      continue;
    }
    cout << min(t, t1);
  }
  return 0;
}
