#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> Ans;
  for (int z = 0; z < t; z++) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n == 1) {
      Ans.push_back(0);
      continue;
    }
    if (s[0] == '>' || s[n - 1] == '<') {
      Ans.push_back(0);
      continue;
    }
    int ans = 0;
    int i = 0;
    int sc = 0;
    while (s[i] == '<') {
      i++;
      sc++;
    }
    ans = sc;
    i = n - 1;
    sc = 0;
    while (s[i] == '>') {
      i--;
      sc++;
    }
    ans = min(ans, sc);
    Ans.push_back(ans);
  }
  for (int i = 0; i < Ans.size(); i++) cout << Ans[i] << "\n";
  return 0;
}
