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