#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, i, tx, ty;
  cin >> a;
  string s;
  for (d = 0; d < a; d++) {
    cin >> b;
    cin >> s;
    tx = 0;
    for (i = 0; i < b; i++) {
      if (s[i] == '>') {
        tx = i;
        break;
      }
    }
    ty = 0;
    for (i = b - 1; i >= 0; i--) {
      if (s[i] == '<') {
        ty = i + 1;
        break;
      }
    }
    int bat = b - ty;
    int rat = tx;
    cout << min(rat, bat) << endl;
  }
  return 0;
}
