#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
vector<long long> v1, p, v;
map<long long, set<long long> > m1;
map<long long, long long> m3, m2;
set<long long> s1, s2;
int d = 0;
long long a;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << 0 << endl;
      continue;
    } else {
      long long a = 0, b = 0;
      while (s[a] == '<') {
        a++;
      }
      while (s[n - 1 - b] == '>') {
        b++;
      }
      if (a > b)
        cout << b << endl;
      else
        cout << a << endl;
    }
  }
  return 0;
}
