#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5;
void solve() {
  stack<char> s1;
  stack<char> s2;
  string a;
  int n;
  cin >> n;
  cin >> a;
  int a1 = 0;
  int a2 = 0;
  for (int i = 0; i < a.size(); ++i) {
    if (a[i] == '<') {
      while (s1.size()) {
        s1.pop();
        a1++;
      }
    } else {
      s1.push(i);
    }
  }
  for (int i = a.size() - 1; i >= 0; --i) {
    if (a[i] == '>') {
      while (s2.size()) {
        s2.pop();
        a2++;
      }
    } else {
      s2.push(i);
    }
  }
  cout << min(s1.size(), s2.size()) << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
