#include <bits/stdc++.h>
using namespace std;
long long max(long long A, long long b) {
  if (A > b) return A;
  return b;
}
long long min(long long A, long long b) {
  if (A < b) return A;
  return b;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long right = 0;
    long long left = 0;
    long long c = 0;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << 0 << endl;
      continue;
    }
    int i = 0;
    while (s[i] != '>') {
      right++;
      i++;
    }
    i = n - 1;
    while (s[i] != '<') {
      left++;
      i--;
    }
    long long ans = min(left, right);
    cout << ans << endl;
  }
}
