#include <bits/stdc++.h>
using namespace std;
long long nMod = 1e9 + 7;
inline long long GCD(long long a, long long b) {
  while (b != 0) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
};
inline long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; };
void vietnakid() {
  int TC;
  cin >> TC;
  while (TC--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int fm = n, lr = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') {
        fm = min(fm, i);
      } else {
        lr = max(lr, i);
      }
    }
    cout << min(fm, n - lr - 1) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  vietnakid();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
