#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
const double EPS = 1e-6;
const long long INF = (1LL << 62);
const long long P = 1e9 + 7;
class UF {
 public:
  vector<int> parent;
  vector<int> size;
  int count;
  UF(int N) {
    count = N;
    parent.resize(N + 1);
    size.resize(N + 1);
    for (int i = 0; i <= N; i++) {
      parent[i] = i;
      size[i] = 1;
    }
  }
  int find(int p) {
    while (p != parent[p]) p = parent[p];
    return p;
  }
  bool connected(int p, int q) { return find(p) == find(q); }
  void join(int p, int q) {
    int rootP = find(p);
    int rootQ = find(q);
    if (rootP == rootQ) return;
    if (size[rootP] < size[rootQ]) {
      parent[rootP] = rootQ;
      size[rootQ] += size[rootP];
    } else {
      parent[rootQ] = rootP;
      size[rootP] += size[rootQ];
    }
    count--;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, n;
  string s;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    UF uset(n);
    for (int i = 1; i < n; i++) {
      if (s[i - 1] == '>') uset.join(i - 1, i);
      if (s[n - i] == '<') uset.join(n - i, n - i - 1);
    }
    map<long long, long long> set_ct;
    for (int i = 0; i < n; i++) set_ct[uset.find(i)] = uset.size[uset.find(i)];
    vector<long long> res;
    for (pair<long long, long long> x : set_ct) {
      res.push_back(x.second);
    }
    sort(res.begin(), res.end());
    long long del = 0;
    for (int i = 0; i < (int)res.size() - 1; i++) {
      del += res[i];
    }
    cout << del << endl;
  }
  return 0;
}
