#include <bits/stdc++.h>
using namespace std;
void solve() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << "0\n";
    } else if (n == 1) {
      cout << 0 << '\n';
    } else {
      int last1 = -1;
      int cnt1 = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == '>') {
          last1 = i;
        }
      }
      for (int i = 0; i < last1; ++i) {
        if (s[i] == '<') ++cnt1;
      }
      int last2 = -1;
      int cnt2 = 0;
      for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '<') {
          last2 = i;
        }
      }
      for (int i = n - 1; i > last2; --i) {
        if (s[i] == '>') ++cnt2;
      }
      cout << min(cnt1, cnt2) << '\n';
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
