#include <bits/stdc++.h>
using namespace std;
void SolveA() {
  size_t n;
  cin >> n;
  size_t res = 0;
  size_t curmax = 0;
  for (size_t i = 1; i <= n; ++i) {
    size_t xi;
    cin >> xi;
    curmax = max(curmax, xi);
    if (curmax == i) ++res;
  }
  cout << res;
}
void SolveB() {
  size_t n;
  {
    string tmp;
    getline(cin, tmp);
    stringstream ss(tmp);
    ss >> n;
  }
  for (size_t iTest = 0; iTest < n; ++iTest) {
    size_t l;
    {
      string tmp;
      getline(cin, tmp);
      stringstream ss(tmp);
      ss >> l;
    }
    string s;
    getline(cin, s);
    size_t res = l - 1;
    for (size_t i = 0; i < l; ++i)
      if (s[i] == '>')
        res = min(res, i);
      else
        res = min(res, l - 1 - i);
    cout << res << "\n";
  }
}
void SolveC() {}
int main() {
  SolveB();
  return 0;
}
