#include <bits/stdc++.h>
using namespace std;
int minimum(int a, int b) { return a > b ? a : b; }
int answer(string s, int beg, int end) {
  if (s[beg] == '<' && s[end] == '>') {
    int ans1 = 0, ans2 = 0;
    while (s[beg] != '>') {
      beg++;
      ans1++;
    }
    while (s[end] != '>') {
      end--;
      ans2++;
    }
    return minimum(ans1, ans2);
  }
  return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    cout << answer(s, 0, n - 1) << "\n";
  }
  return 0;
}
