#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  string s;
  while (t--) {
    cin >> n;
    cin >> s;
    int num = 0, num1 = 0, num2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>')
        num1++;
      else {
        num2++;
        if (num1 >= num2) num++;
      }
    }
    int k = min(num1, num2);
    cout << k - num << endl;
  }
}
