#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = n - 1;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '>') {
      ans = min(ans, i);
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == '<') ans = min(ans, (int)s.size() - i - 1);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) solve();
}
