#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '<' && s.back() == '>') {
      int ans = INT_MAX;
      int ct1 = 0, ct2 = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == '<') {
          ct1++;
        } else {
          break;
        }
      }
      for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '>') {
          ct2++;
        } else {
          break;
        }
      }
      cout << min(ct1, ct2) << '\n';
    } else {
      cout << 0 << '\n';
    }
  }
}
