#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long i, a = n, b = -1;
    for (i = 0; i < n; i++) {
      if (s[i] == '>') {
        a = i;
        break;
      }
    }
    long long rem1 = a;
    for (i = n - 1; i >= 0; i--) {
      if (s[i] == '<') {
        b = i;
        break;
      }
    }
    long long rem2 = (n - b) - 1;
    cout << min(rem1, rem2) << "\n";
  }
  return 0;
}
