#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  string st;
  cin >> st;
  long long int cnt = 0, cnt1 = 0;
  for (long long int i = 0; i < n; i++) {
    if (st[i] == '>') {
      cnt = i;
      break;
    }
  }
  for (long long int i = n - 1; i > -1; i--) {
    if (st[i] == '<') {
      cnt1 = n - i - 1;
      break;
    }
  }
  cout << min(cnt, cnt1) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int w;
  cin >> w;
  while (w--) {
    solve();
  }
  return 0;
}
