#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;
int n;
string s;
bool check(int i, bool co) {
  char L = s[(i - 1 + n) % n], R = s[i];
  if (L == '-' || R == '-') return true;
  if (L == '>' && R == '<') return false;
  if (L == '<' && R == '>') return false;
  return co;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    int res = 0;
    int dir = 0;
    bool co = true;
    for (int i = (0); i <= (n - 1); i++)
      if (s[i] == '>') {
        if (dir < 0)
          co = false;
        else
          dir = 1;
      } else if (s[i] == '<') {
        if (dir > 0)
          co = false;
        else
          dir = -1;
      }
    for (int i = (0); i <= (n - 1); i++) {
      res += check(i, co);
    }
    cout << res << "\n";
  }
  return 0;
}
