#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << 0 << endl;
      continue;
    }
    int p1, p2;
    p1 = p2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<') {
        p1++;
      } else {
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '>') {
        p2++;
      } else {
        break;
      }
    }
    cout << min(p1, p2) << endl;
  }
  return 0;
}
