#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int pos_f = 0, pos_s = 0, index = n - 1;
    while (s[pos_f] != '>') {
      pos_f++;
      if (pos_f >= n) break;
    }
    while (s[index] != '<') {
      index--;
      pos_s++;
      if (index < 0) break;
    }
    cout << min(pos_s, pos_f) << '\n';
  }
  return 0;
}
