#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
int gcd(int a, int b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
bool compare(long long i, long long j) { return i > j; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  int n, count1, count2;
  string str;
  while (t--) {
    cin >> n >> str;
    count1 = 0;
    count2 = 0;
    if (n < 2) {
      cout << "0" << endl;
    } else if (str[0] == '>' || str[n - 1] == '<') {
      cout << "0" << endl;
    } else {
      for (int i = 0; i < n; i++) {
        if (str[i] == '>') {
          count1 = i;
          break;
        }
      }
      for (int i = n - 1; i >= 0; i--) {
        if (str[i] == '<') {
          count2 = n - 1 - i;
          break;
        }
      }
      cout << min(count1, count2) << endl;
    }
  }
}
