#include <bits/stdc++.h>
using namespace std;
bool right(string s) {
  int n = s.length();
  for (int i = 0; i < n - 1; ++i) {
    if (s.at(i) == '>' && s.at(i + 1) == '<') {
      return true;
    }
  }
  return false;
}
bool left(string s) {
  int n = s.length();
  for (int i = n - 1; i > 0; --i) {
    if (s.at(i) == '<' && s.at(i - 1) == '>') {
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t > 0) {
    t--;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int x = 0, y = 0;
    for (int i = 0; i < n; ++i) {
      if (s.at(i) == '>') {
        x++;
      } else {
        y++;
      }
    }
    if (x == 0 || y == 0) {
      cout << 0 << "\n";
    } else if (x >= y) {
      if (right(s) == true) {
        cout << y - 1 << "\n";
      } else {
        cout << y << "\n";
      }
    } else {
      if (left(s) == true) {
        cout << x - 1 << "\n";
      } else {
        cout << x << "\n";
      }
    }
  }
  return 0;
}
