#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans;
  int t;
  cin >> t;
  int n, i;
  int fl, fl2;
  char a[110];
  while (t--) {
    int s1, s2;
    s1 = s2 = 0;
    fl = -1;
    fl2 = -1;
    cin >> n;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] == '<')
        s1++;
      else
        s2++;
    }
    for (i = 0; i < n; i++) {
      if (a[i] == '>' && fl < 0) fl = i;
      if (fl >= 0) {
        if (a[i] == '<') {
          fl2 = i;
        }
      }
    }
    if (fl2 >= 0) {
      ans = min(fl - 0, n - 1 - fl2);
    } else
      ans = min(s1, s2);
    if (a[0] == a[n - 1]) ans = 0;
    cout << ans << endl;
  }
  return 0;
}
