#include <bits/stdc++.h>
using namespace std;
set<long long int> s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, e = 0, r = 0;
    cin >> n;
    string s;
    cin >> s;
    for (i = 0; i < n; ++i)
      if (s[i] == '>')
        ++e;
      else
        ++r;
    if (e == n || r == n) {
      cout << n - 1 << "\n";
      continue;
    }
    long long int j = n - 1;
    i = 0;
    while (s[i] == '<') ++i;
    while (s[j] == '>') --j;
    cout << min(i, n - 1 - j) << "\n";
  }
  return 0;
}
