#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long N = 200005;
long long n;
void solve() {
  long long i, j, k;
  cin >> n;
  string s;
  cin >> s;
  long long ans = n - 1;
  for (i = 0; i < n; i++)
    if (s[i] == '>') break;
  ans = min(i, ans);
  for (i = n - 1; i >= 0; i--)
    if (s[i] == '<') break;
  ans = min(ans, n - 1 - i);
  cout << ans << "\n";
  return;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1, i, j, k;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
