#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '<') cnt++;
  }
  ans = max(ans, cnt);
  ans = max(ans, n - cnt);
  int rev = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '>') rev++;
    if (s[i] == '<') cnt--;
    ans = max(ans, rev + cnt);
  }
  cout << n - ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) solve();
}
