#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int A[MAX];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
      if (S[i] == '<' && S[i + 1] == '>') {
        int l = i - 1, r = i + 2;
        bool isL = 0, isR = 0;
        while (l >= 0) {
          if (S[l] == '>') {
            isL = 1;
            break;
          }
          l--;
        }
        while (r < n) {
          if (S[r] == '<') {
            isR = 1;
            break;
          }
          r++;
        }
        if (isR == 1 && isL == 1) {
          continue;
        } else {
          ans += min(i + 1, (n - i - 1));
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
