#include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> s;
    int a = 0, b = 0;
    for (int i = 0; i < n && s[i] != '>'; ++i) ++a;
    for (int i = n - 1; i >= 0 && s[i] != '<'; --i) ++b;
    cout << min(a, b) << "\n";
  }
  return 0;
}
