#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long binpow(long long base, long long exp, int mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
long long mod(long long x) {
  return ((x % 1000000007LL + 1000000007LL) % 1000000007LL);
}
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
bool isPrime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    string s;
    cin >> s;
    long long int count1 = count(s.begin(), s.end(), '<');
    long long int count2 = count(s.begin(), s.end(), '>');
    if ((count1 > 0 && count2 == 0) || (count2 > 0 && count1 == 0)) {
      cout << n << "\n";
    } else {
      long long int ans = 0;
      for (long long int i = 0; i < n; i++) {
        if (s[i % n] == '-' || s[(i + 1) % n] == '-') {
          ans++;
        }
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
