#include <bits/stdc++.h>
using namespace std;
int t;
int n;
string s;
int ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    int i = 0;
    cin >> n;
    cin >> s;
    while (s[i] == '<') {
      i++;
    }
    int j = n - 1;
    while (s[j] == '>') {
      j++;
    }
    ans = min(i, j) % n;
    cout << ans << '\n';
  }
  return 0;
}
