#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b) {
    int t = a % b;
    a = b;
    b = t;
  }
  return a;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count = n - 1;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '>' || s[n - i - 1] == '<') count = min(count, i);
  }
  cout << count << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
