#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5, inf = 1e9 + 7;
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << " = " << h << ", ";
  _dbg(sdbg + 1, a...);
}
inline bool isDigit(char c) { return '0' <= c && c <= '9'; }
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline bool isSquare(T x) {
  T y = sqrt(x + 0.5);
  return (y * y) == x;
}
template <class T1, class T2>
inline T1 gcd(T1 a, T2 b) {
  return b ? gcd(b, a % b) : a;
}
template <class T1, class T2>
inline T1 eqMin(T1 &x, const T2 &y) {
  if (T1(y) < x) return x = y;
  return x;
}
template <class T1, class T2>
inline T1 eqMax(T1 &x, const T2 &y) {
  if (T1(y) > x) return x = y;
  return x;
}
template <class T1, class T2>
inline T1 min(const T1 &x, const T2 &y) {
  return x < (T1)y ? x : (T1)y;
}
template <class T1, class T2>
inline T1 max(T1 &x, const T2 &y) {
  return x > (T1)y ? x : (T1)y;
}
template <typename T>
inline T getint() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') p = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * p;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '(' << p.fi << ", " << p.se << ')';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, flg = 0;
    cin >> n;
    string s;
    cin >> s;
    int lft = 0, rgt = 0;
    for (int i = 0; i < n; i++)
      if (s[i] == '<') lft = i;
    for (int i = n - 1; i >= 0; i--)
      if (s[i] == '>' && lft <= i) rgt = i;
    cout << max(0, rgt - lft) << "\n";
  }
  return 0;
}
