#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    char cf, cl;
    cf = s[0];
    cl = s[n - 1];
    if ((cf == '>') && (cl == '<')) {
      cout << 0 << '\n';
      continue;
    }
    if (cf == cl) {
      cout << 0 << '\n';
      continue;
    }
    int rem_l = 1;
    while (rem_l < n) {
      if (s[rem_l - 1] == '>')
        break;
      else
        rem_l++;
    }
    int rem_r = 1;
    int idx = n - 2;
    while (idx >= 0) {
      if (s[idx] == '<')
        break;
      else {
        rem_r++;
        idx--;
      }
    }
    cout << min(rem_l, rem_r) << '\n';
  }
  cout.flush();
  return 0;
}
