#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> mymap;
int arr[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test;
  cin >> test;
  while (test--) {
    int n;
    cin >> n;
    string str;
    cin >> str;
    int le = 0;
    int ri = 0;
    for (int i = 0; i < str.length(); i++)
      if (str[i] == '>') {
        le = i;
        break;
      }
    for (int i = str.length() - 1; i >= 0; i--)
      if (str[i] == '<') {
        ri = str.length() - i + 1;
        break;
      }
    cout << min(le, ri) << endl;
  }
  return 0;
}
