#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  io();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> a(n);
    vector<int> b(n);
    bool l = 0;
    bool r = 0;
    for (int i = 0; i < n; i++) {
      int x = (i + 1) % n;
      if (s[i] == '<') {
        l = 1;
        a[x] = 1;
        b[i] = 2;
      } else if (s[i] == '>') {
        r = 1;
        a[x] = 2;
        b[i] = 1;
      } else {
        a[x] = 3;
        b[i] = 3;
      }
    }
    int coun = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == 3 || b[i] == 3)
        coun++;
      else if (a[i] == 2 && b[i] == 1 && !(l && r))
        coun++;
      else if (a[i] == 1 && b[i] == 2 && !(l && r))
        coun++;
    }
    cout << coun << "\n";
  }
  return 0;
}
