#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, u;
  cin >> m;
  string s;
  for (n = 0; n < m; n++) {
    cin >> u;
    cin >> s;
    int endd = 0;
    for (int j = u - 1; j >= 0; j--) {
      if (s[j] == '<') {
        endd = j;
        break;
      }
    }
    int strt = 0;
    for (int k = 0; k < u; k++) {
      if (s[k] == '>') {
        strt = k;
        break;
      }
    }
    int fina = strt;
    int nina = u - endd + 1;
    cout << min(fina, nina) << endl;
  }
  return 0;
}
