#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
const double EPS = 1e-6;
const long long INF = (1LL << 62);
const long long P = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, n;
  cin >> t;
  string s;
  while (t--) {
    cin >> n;
    cin >> s;
    if (s[0] == '>' || s.back() == '<') {
      cout << 0 << endl;
    } else {
      long long fl = s.find_first_of('>');
      long long lf = s.find_last_of('<');
      cout << min(fl, n - (lf + 1)) << endl;
    }
  }
  return 0;
}
