#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long id = 0;
    long long an;
    while (id < n && s[id] != '>') {
      id++;
    }
    an = id;
    id = n - 1;
    while (id >= 0 && s[id] != '<') {
      id--;
    }
    an = min(an, (n - 1 - id));
    cout << an << endl;
  }
  return 0;
}
