#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  unsigned long long int n, t;
  cin >> t;
  string s;
  for (int i = 0; i < t; i++) {
    cin >> n >> s;
    if (s[0] == '>' || s[n - 1] == '<')
      cout << 0 << endl;
    else {
      unsigned long long int count = 0;
      for (int i = 0; i < n - 1; i++) {
        if (s[i] == '<' && s[i + 1] == '>') {
          count++;
          break;
        }
      }
      if (count != 0)
        cout << 1 << endl;
      else {
        unsigned long long int be = -1, end = -1;
        for (int i = 0; s[i]; i++)
          if (s[i] == '>') {
            be = i;
            break;
          }
        for (int i = n - 1; i >= 0; i--)
          if (s[i] == '<') {
            end = i;
            break;
          }
        cout << min(n - 1 - end, be) << endl;
      }
    }
  }
  return 0;
}
