#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n, i, ans, m;
  cin >> t;
  while (t--) {
    cin >> n;
    string s;
    cin >> s;
    ans = n;
    m = 0;
    for (i = 0; i < n; i++) {
      if (s[i] == '>')
        break;
      else
        ++m;
    }
    ans = min(ans, m);
    m = 0;
    for (i = n - 1; i >= 0; i--) {
      if (s[i] == '<')
        break;
      else
        ++m;
    }
    ans = min(ans, m);
    cout << ans << endl;
  }
  return 0;
}
