#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7, MAXN = 2e5 + 5;
int T, N, M, K, Q, A[MAXN], B[MAXN];
string S;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
void fillA() {
  for (int i = 0; i < N; ++i) cin >> A[i];
}
long long fast_pow(long long b, long long e) {
  long long ans = 1;
  while (e > 0) {
    if (e & 1) ans = (ans * b) % MOD;
    e >>= 1;
    b = (b * b) % MOD;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> T;
  while (T--) {
    cin >> N >> S;
    int l = N;
    if (l == 1 or !(S[0] == '<' and S[l - 1] == '>')) {
      cout << 0 << '\n';
      continue;
    }
    int x, y;
    for (int i = 0; i < l; ++i)
      if (S[i] == '>') {
        x = i;
        break;
      }
    for (int i = l - 1; i > -1; --i)
      if (S[i] == '<') {
        y = i;
        break;
      }
    cout << min(x, l - y - 1) << '\n';
  }
  return 0;
}
