#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int _ = 1;
  cin >> _;
  while (_--) {
    int n;
    cin >> n;
    vector<char> s(n);
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    int ans = 0;
    int it = 0;
    while (it < n && s[it] != '>') {
      it++;
    }
    ans = it;
    it = n - 1;
    while (it >= 0 && s[it] != '<') {
      it--;
    }
    ans = min(ans, n - it - 1);
    cout << ans << endl;
  }
}
