#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 9;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '<' && s[n - 1] == '>') {
      int x, y;
      for (int i = 0; i < n; i++) {
        if (s[i] == '>') {
          x = i;
          break;
        }
      }
      for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '<') {
          y = i;
          break;
        }
      }
      y = n - 1 - y;
      cout << min(x, y) << '\n';
    } else
      cout << "0\n";
  }
  return 0;
}
