#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
bool cmps(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second < p2.second;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string str;
    cin >> str;
    long long count = 0;
    long long ans = INT_MAX;
    if (str[0] == '>' || str[str.size() - 1] == '<')
      ans = 0;
    else {
      for (long long i = 0; i < n; i++) {
        if (str[i] == '>') {
          ans = min(ans, i);
        }
      }
      for (long long i = n - 1; i >= 0; i--) {
        if (str[i] == '<') ans = min(ans, n - i - 1);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
