#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    long long x = a % b;
    a = b;
    b = x;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  long long t;
  cin >> t;
  ;
  for (int i = 0; i < t; i++) {
    long long n;
    cin >> n;
    ;
    string s;
    cin >> s;
    long long a = 0, b = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        a++;
      else
        b++;
    }
    if (s[0] == '>' && s[n - 1] == '<')
      cout << min(a, b);
    else if (s[0] == '>' && s[n - 1] == '>')
      cout << a;
    else if (s[0] == '<' && s[n - 1] == '<')
      cout << b;
    else
      cout << 0;
    cout << "\n";
  }
}
