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