#include <bits/stdc++.h>
using namespace std;
long long powermodm(long long x, long long n, long long M) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
long long power(long long _a, long long _b) {
  long long _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a);
    _b /= 2;
    _a = (_a * _a);
  }
  return _r;
}
long long isPrime[100001];
void sieve();
vector<long long> Divisors(long long n);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string a;
    cin >> a;
    long long cnt1 = 0, cnt2 = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] == '>')
        cnt1++;
      else
        cnt2++;
    }
    long long ans, cn1 = 0, cn2 = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] == '>' && i != (n - 1)) {
        if (a[i + 1] == '<') cn1++;
      } else if (a[i] == '<' && i != 0) {
        if (a[i - 1] == '<') cn1++;
      }
    }
    ans = cnt2 - cn1;
    for (long long i = 0; i < n; i++) {
      if (a[i] == '<' && i != 0) {
        if (a[i - 1] == '>') cn2++;
      } else if (a[i] == '>' && i != (n - 1)) {
        if (a[i + 1] == '>') cn2++;
      }
    }
    long long hey = cnt1 - cn2;
    ans = min(ans, hey);
    cout << ans << endl;
  }
}
