#include <bits/stdc++.h>
using namespace std;
int main() {
  int test, x;
  scanf("%d", &test);
  for (int tt = 1; tt <= test; tt++) {
    scanf("%d", &x);
    string str;
    cin >> str;
    int p = 0, fst = 0, lst = 0, fstcnt = 0, lstcnt = 0;
    bool yes = false;
    for (int i = 0; i < str.length() - 1; i++) {
      if (str[i] == '<' && str[i + 1] == '>') {
        p = i;
        yes = true;
        break;
      }
    }
    if (yes == true) {
      fst = p;
      bool istrue = false;
      lst = p + 1;
      while (fst >= 0) {
        if (str[fst] == '>') {
          istrue = true;
          break;
        } else
          fstcnt++;
        fst--;
      }
      while (lst < str.length()) {
        if (str[lst] == '<') {
          istrue = true;
          break;
        } else
          lstcnt++;
        lst++;
      }
      if (istrue == true)
        cout << 0 << endl;
      else {
        if (fstcnt <= lstcnt)
          cout << fstcnt << endl;
        else
          cout << lstcnt << endl;
      }
    } else
      cout << 0 << endl;
  }
  return 0;
}
