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