#include <bits/stdc++.h>
const int maxn = 1e5 * 2 + 20;
using namespace std;
bool isGood(string myString) {}
int q;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> q;
  while (q--) {
    int ll;
    string s;
    cin >> ll;
    cin >> s;
    int r = 0, l = 0;
    for (int i = 0; i < s.size(); i++) {
      if (i == 0 || i == s.size() - 1) {
        if (s[i] == '<' || s[i] == '>') {
        }
      }
      if (s[i] == '<') {
        l++;
      } else {
        break;
      }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
      if (i == s.size() - 1 && s[i] == '>') {
      }
      if (s[i] == '>') {
        r++;
      } else {
        break;
      }
    }
    cout << min(l, r) << endl;
  }
  return 0;
}
