#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int n;
  string s;
  for (int i = 0; i < t; ++i) {
    cin >> n;
    cin >> s;
    int l = s.find_first_of('>');
    if (l == string::npos) l = n - 1;
    int r = s.find_last_of('<');
    if (r == string::npos) r = 1;
    cout << min(l, n - 1 - r) << '\n';
  }
  return 0;
}
