#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    int a = n, b = n;
    for (int i = 0; i < n; i++)
      if (s[i] == '>') {
        a = i;
        break;
      }
    for (int i = n - 1; i >= 0; i--)
      if (s[i] == '<') {
        b = n - i - 1;
        break;
      }
    printf("%d\n", min(a, b));
  }
  return 0;
}
