#include <bits/stdc++.h>
using namespace std;
bool vs[2001][2001];
int a[200005];
int fre[26];
int n, m, v, k, mx, q, res, x, c;
long long ans;
int mnhp[10000], hi;
void fix(int ind) {
  int p = ((ind - 1) / 2);
  while (p >= 0 && mnhp[ind] < mnhp[p]) {
    swap(mnhp[ind], mnhp[p]);
    ind = p;
    p = ((ind - 1) / 2);
  }
}
int insert(int x) {
  mnhp[hi] = x;
  fix(hi);
  hi++;
}
int extractMin() {
  int mn = mnhp[0], i = 0, ch1, ch2;
  while ((i * 2) + 1 < hi) {
    if ((i * 2) + 2 < hi)
      ch2 = mnhp[((i * 2) + 2)];
    else
      ch2 = 2e9;
    ch1 = mnhp[((i * 2) + 1)];
    if (ch1 < ch2) {
      mnhp[i] = ch1;
      i = (2 * i) + 1;
    } else {
      mnhp[i] = ch2;
      i = (2 * i) + 2;
    }
  }
  hi--;
  return mn;
}
void display() {
  for (int i = 0; i < hi; i++) {
    cout << mnhp[i] << " ";
  }
  cout << endl;
}
int par[10000], pc[10000];
int findp(int ind) {
  while (par[ind] != ind) {
    ind = par[ind];
  }
  return ind;
}
void uni(int i, int j) {
  int v1 = findp(i);
  int v2 = findp(j);
  if (pc[v1] >= pc[v2]) {
    par[v2] = v1;
    pc[v1] = max(pc[v1], pc[v2] + 1);
  } else {
    par[v1] = v2;
    pc[v2] = max(pc[v2], pc[v1] + 1);
  }
}
int t;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  while (n--) {
    string s;
    cin >> t >> s;
    if (t == 2 && s[0] == '<' && s[1] == '>') {
      cout << 2 << endl;
      continue;
    }
    int v = -1, v0 = -1;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '>') {
        v = i;
        break;
      }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] == '<') {
        v0 = i;
        break;
      }
    }
    if (v == -1) {
      cout << t - v0 << endl;
    } else if (v0 == -1) {
      cout << v << endl;
    } else {
      cout << min(t - v0, v) << endl;
    }
  }
  return 0;
}
