#include <bits/stdc++.h>
using namespace std;
const long long N = 1e17 + 10;
const long long M = 1e9 + 7;
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
void fn1() {
  long long n, cnt = 0;
  string s;
  cin >> n >> s;
  vector<long long> A;
  for (__typeof(0) i = 0; i < n; i++) A.push_back(0);
  long long sum1 = 0, sum2 = 0;
  for (__typeof(0) i = 0; i < n; i++) {
    if (s[i] != '<') sum1++;
  }
  for (__typeof(0) i = 0; i < n; i++) {
    if (s[i] != '>') sum2++;
  }
  if (sum1 == n || sum2 == n) {
    cout << n << endl;
    return;
  }
  s += s;
  s += s;
  for (__typeof(n) i = n; i < 2 * n; i++) {
    if (s[i] == '-') {
      A[i % n] = 1;
      A[(i + 1) % n] = 1;
    }
  }
  for (auto u : A) cnt += u;
  cout << cnt << endl;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    fn1();
  }
}
