#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 50;
char s[maxn];
int main() {
  int i, j, k, n, m, t, ans;
  int cnt1, cnt2;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    scanf("%s", s);
    ans = n - 1;
    cnt1 = 0, cnt2 = 0;
    for (i = 0; i < n; i++)
      if (s[i] == '<')
        cnt1++;
      else
        cnt2++;
    int len = 0;
    bool flag = false;
    for (i = 0; i < n; i++)
      if (s[i] == '>') break;
    if (i == n) {
      printf("0\n");
      continue;
    }
    int tmp = 0;
    for (j = i; j < n; j++) {
      if (s[j] == '<') {
        if (flag) {
          tmp++;
          len = max(len, tmp);
        } else {
          flag = true;
          tmp = 1;
        }
      } else {
        flag = false;
        len = max(len, tmp);
        tmp = 0;
      }
    }
    ans = min(ans, cnt1 - len);
    len = 0;
    for (i = n - 1; i >= 0; i--)
      if (s[i] == '<') break;
    if (i == -1) {
      printf("0\n");
      continue;
    }
    tmp = 0;
    for (j = i; j >= 0; j--) {
      if (s[j] == '>') {
        if (flag) {
          tmp++;
          len = max(len, tmp);
        } else {
          flag = true;
          tmp = 1;
        }
      } else {
        flag = false;
        len = max(len, tmp);
        tmp = 0;
      }
    }
    ans = min(ans, cnt2 - len);
    printf("%d\n", ans);
  }
}
