#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  while (test--) {
    long long num;
    vector<char> str;
    cin >> num;
    long long n = num;
    while (n--) {
      char a;
      cin >> a;
      str.push_back(a);
    }
    vector<char>::iterator it;
    if (num == 1) {
      cout << "0" << endl;
    } else {
      long long less = 0, more = 0;
      for (long long i = 0; i < str.size() - 1; i++) {
        if (str[i] == '>' && str[i + 1] == '<') str.erase(str.begin() + i + 1);
        if (str[i] == '>')
          less++;
        else
          more++;
      }
      if (less == num || more == num) {
        cout << "0" << endl;
      } else {
        long long l = 0, b = 0;
        for (it = str.begin(); it != str.end(); it++) {
          if (*it == '<')
            l++;
          else
            b++;
        }
        if (l >= b)
          cout << b << endl;
        else
          cout << l << endl;
      }
    }
  }
  return 0;
}
