#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int ans1, ans2;
int T;
int main() {
  cin >> T;
  while (T--) {
    int j;
    cin >> n >> s;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '>') {
        ans1 = i;
        break;
      }
    }
    j = 0;
    for (int i = n - 1; i >= 0; --i) {
      if (s[i] == '<') {
        ans2 = j;
        break;
      }
      j++;
    }
    cout << min(ans1, ans2) << endl;
  }
  return 0;
}
