#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string str;
    cin >> str;
    long long count = 0, count2 = 0;
    for (int i = 0; i < n; i++) {
      if (str[i] == '<') {
        count++;
      } else {
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (str[i] == '>') {
        count2++;
      } else {
        break;
      }
    }
    cout << min(count, count2) << endl;
  }
  return 0;
}
