#include <bits/stdc++.h>
using namespace std;
long long max(long long A, long long b) {
  if (A > b) return A;
  return b;
}
long long min(long long A, long long b) {
  if (A < b) return A;
  return b;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long right = 0;
    long long left = 0;
    long long c = 0;
    for (int i = 0; s[i] != '\0'; i++) {
      if (s[i] == '<') c++;
      if ((i <= n - 2 && s[i] == '>' && s[i + 1] == '<')) right++;
      if (i >= 1 && s[i] == '<' && s[i - 1] == '>') left++;
    }
    if (c == 0 || c == n) {
      cout << 0 << endl;
      continue;
    }
    if (left == 0 && right == 0) {
      cout << min(c, n - c) << endl;
      continue;
    }
    long long ans = min(n - c - left, c - right);
    cout << ans << endl;
  }
}
