#include <bits/stdc++.h>
char a[200005], b[200005];
int c[200005];
int main() {
  int n, T, i;
  scanf("%d", &T);
  while (T--) {
    char s[102];
    scanf("%d %s", &n, &s[1]);
    int l = 1, r = n;
    for (i = 1; i <= n; i++)
      if (s[i] == '>') {
        l = i;
        break;
      }
    for (i = n; i >= 1; i--)
      if (s[i] == '<') {
        r = i;
        break;
      }
    printf("%d\n", l - 1 < n - r ? l - 1 : n - r);
  }
  return 0;
}
