#include <bits/stdc++.h>
using namespace std;
inline void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long maxn = 2e5 + 123;
const long long inf = 1e9 + 123;
const long long linf = 1e18 + 123;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1);
int dx[4] = {0, 1, -1, 0};
int dy[4] = {1, 0, 0, -1};
int main() {
  boost();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int id = 0, id1 = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '>') {
        id = i;
        break;
      }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] == '<') {
        id1 = s.size() - i;
        break;
      }
    }
    cout << min(id, id1) << "\n";
  }
  exit(0);
}
