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