#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, k1, n, k2, i;
  char s[1000];
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    for (i = 0; i < n; i++)
      if (s[i] == '>') k1 = i;
    for (i = n - 1; i >= 0; i--)
      if (s[i] == '<') k2 = n - 1 - i;
    cout << min(k1, k2) << endl;
  }
  return 0;
}
