#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << "0" << endl;
      continue;
    }
    long long x = 0, y = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '>') break;
      x++;
    }
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] == '<') break;
      y++;
    }
    long long ans = min(x, y);
    cout << ans << endl;
  }
}
