#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
const long long N = 300005;
long long t, n;
string s;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    bool flag = true, flag1 = true;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '<') flag = false;
      if (s[i] == '>') flag1 = false;
    }
    if (flag or flag1) {
      cout << n << '\n';
      continue;
    }
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '-' or s[(i - 1 + n) % n] == '-') ans++;
    }
    cout << ans << '\n';
  }
}
