#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  unsigned long long int n, t;
  cin >> t;
  string s;
  for (int i = 0; i < t; i++) {
    cin >> n >> s;
    if (s[0] == '>' || s[n - 1] == '<')
      cout << 0 << endl;
    else {
      unsigned long long int count = 0;
      for (int i = 0; i < n - 1; i++) {
        if (s[i] == '<' && s[i + 1] == '>') {
          count++;
          break;
        }
      }
      if (count != 0) {
        count = 0;
        int ch = 0;
        vector<bool> v(n, true);
        for (int i = 0; i < n; i++)
          if (s[i] == '>') count++;
        for (int i = 0; i < n - 1; i++) {
          if (v[i] == true && v[i + 1] == true) {
            if (s[i] != s[i + 1]) {
              ch++;
              if (count > n - count) {
                if (s[i] == '<')
                  v[i] = false;
                else
                  v[i + 1] = false;
              } else {
                if (s[i] == '>')
                  v[i] = false;
                else
                  v[i + 1] = false;
              }
            }
          }
        }
        if (ch > 1)
          cout << ch << endl;
        else
          cout << min(count, n - count);
      } else
        cout << 0 << endl;
    }
  }
  return 0;
}
