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