#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, count = 0, a = 0;
    cin >> n;
    string s;
    cin >> s;
    for (i = 0; i < n; i++) {
      if (s[i] == '<') a++;
      if (s[i] == '>' && a - 1 >= 0) {
        a--;
        count++;
      }
    }
    cout << count << '\n';
  }
}
