#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    string a;
    cin >> a;
    vector<bool> us(n);
    long long cnt = 0, sch = 0;
    for (long long i = 0; i < n; ++i) {
      long long x = i, y = (i + 1) % n;
      if (a[i] == '-') {
        us[x] = true;
        us[y] = true;
      }
      if (a[i] == '>') {
        ++cnt;
      }
      if (a[i] == '<') {
        ++sch;
      }
    }
    if (!sch || !cnt) {
      cout << n << endl;
    } else {
      long long ans = 0;
      for (long long i = 0; i < n; ++i) {
        ans += us[i];
      }
      cout << ans << endl;
    }
  }
}
