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