#include <bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 60) - 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    bool f = true;
    long long mini = INF;
    for (long long i = 0; i <= n - 1; i++) {
      if (s[i] == '>') {
        mini = min(i, mini);
        break;
      }
    }
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] == '<') {
        mini = min(n - i - 1, mini);
        break;
      }
    }
    if (s[0] == '>' || s[n - 1] == '<')
      cout << 0 << "\n";
    else
      cout << mini << "\n";
  }
  cerr << "Time Taken:" << (float)clock() / CLOCKS_PER_SEC * 1000 << "ms"
       << "\n";
  return 0;
}
