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