#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long a = 0, b = 0;
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '>') break;
    a++;
  }
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '<') break;
    b++;
  }
  cout << min(a, b) << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
