#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long mod(long long x) { return ((x % M + M) % M); }
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)); }
long long sub(long long a, long long b) { return mod(mod(a) - mod(b)); }
long long modPow(long long a, long long b) {
  if (b == 0) return 1LL;
  if (b == 1) return a % M;
  long long res = 1;
  while (b) {
    if (b % 2 == 1) res = mul(res, a);
    a = mul(a, a);
    b = b / 2;
  }
  return res;
}
long long Pow(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long res = 1;
  while (b) {
    if (b % 2 == 1) res = res * a;
    a = a * a;
    b = b / 2;
  }
  return res;
}
long long sumOfDigits(long long n) {
  long long s = 0;
  while (n != 0) {
    s = s + n % 10;
    n = n / 10;
  }
  return s;
}
bool check(long long i, string s) {
  char temp = s[i];
  long long n = s.size();
  long long j = (i + 1) % n;
  while (j != i) {
    if (s[j] != temp && s[j] != '-') {
      return false;
    }
    j = (j + 1) % n;
  }
  return true;
}
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long ans = 0;
  long long streak = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '-') {
      if (i == s.size() - 1 && s.size() != 1) {
        if (s[0] != '-') {
          ans = ans + streak + 2;
        } else {
          ans = ans + streak + 1;
        }
      } else {
        streak++;
      }
    } else {
      if (streak != 0) {
        ans = ans + streak + 1;
        streak = 0;
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    if (s[i] != '-') {
      if (check(i, s)) {
        ans = n;
      }
      break;
    }
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
