#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long fastpow(long long x, long long p);
long long fastpow(long long x, long long p, long long mod);
long long fact(long long x);
long long fact(long long x, long long mod);
long long C(long long n, long long k);
long long C(long long n, long long k, long long mod);
void debug_array(int n, int *a);
void debug_array(vector<int> a);
void debug_array(int n, long long *a);
template <class T>
void rseq(int n, T *a);
vector<int> z_function(string s);
template <class T>
T gcd(T a, T b);
class SegmentTree {
 public:
  int nn;
  int *tree;
  int sres;
  SegmentTree(int n, int *a, int stres) {
    tree = (int *)malloc(2 * n * sizeof(int));
    nn = n;
    sres = stres;
    fill(tree, tree + 2 * n, 0);
    memcpy(tree + n, a, n * sizeof(int));
    for (int i = n - 1; i > 0; i--) {
      tree[i] = f(tree[2 * i], tree[2 * i + 1]);
    }
  }
  int f(int a, int b) { return a + b; }
  int q(int l, int r) {
    l += nn;
    r += nn;
    int res = sres;
    while (r > l) {
      if (l % 2 == 1) {
        res = f(res, tree[l]);
        l++;
      }
      if (r % 2 == 1) {
        r--;
        res = f(res, tree[r]);
      }
      r /= 2;
      l /= 2;
    }
    return res;
  }
  void u(int i, int v) {
    i += nn;
    tree[i] = v;
    i /= 2;
    while (i > 0) {
      tree[i] = f(tree[2 * i], tree[2 * i + 1]);
      i /= 2;
    }
  }
};
void solve(int n, string s) {
  int l = 0, r = 0;
  for (int i = 0; i < (s.size()); i++) {
    if (s[i] == '>') r++;
    if (s[i] == '<') l++;
  }
  if (!l || !r) {
    cout << n << endl;
    return;
  }
  int a[n];
  fill(a, a + n, 0);
  for (int i = 0; i < n; i++) {
    if (s[i] == '-') {
      a[i] = 1;
      a[(i + 1) % n] = 1;
    }
  }
  int res = 0;
  for (int i = 0; i < (n); i++) {
    res += a[i];
  }
  cout << res << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  for (int k = 0; k < (t); k++) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    solve(n, s);
  }
  return 0;
}
vector<int> z_function(string s) {
  vector<int> z(s.size());
  int l = 0, r = 0, n = s.size();
  z[0] = 0;
  for (int i = 1; i < n; i++) {
    if (r >= i) {
      z[i] = min(z[i - l], r - i + 1);
    }
    while (z[i] + i < n && s[z[i]] == s[z[i] + i]) {
      z[i]++;
    }
    if (i + z[i] - 1 > r) {
      l = i;
      r = l + z[i] - 1;
    }
  }
  return z;
}
template <class T>
void rseq(int n, T *a) {
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
}
void debug_array(int n, int *a) {
  return;
  for (int i = 0; i < n; i++) {
    cerr << a[i] << ' ';
  }
  cerr << endl;
}
void debug_array(vector<int> a) {
  return;
  for (int i = 0; i < a.size(); i++) {
    cerr << a[i] << ' ';
  }
  cerr << endl;
}
void debug_array(int n, long long *a) {
  return;
  for (int i = 0; i < n; i++) {
    cerr << a[i] << ' ';
  }
  cerr << endl;
}
long long fastpow(long long x, long long p) {
  long long r = 1;
  while (p > 0) {
    if (p % 2) {
      r = r * x;
      p--;
    } else {
      x = x * x;
      p /= 2;
    }
  }
  return r;
}
long long fastpow(long long x, long long p, long long mod) {
  long long r = 1;
  while (p > 0) {
    if (p % 2) {
      r = r * x % mod;
      p--;
    } else {
      x = x * x % mod;
      p /= 2;
    }
  }
  return r;
}
long long fact(long long x) {
  long long r = 1;
  for (int i = 1; i <= x; i++) {
    r *= i;
  }
  return r;
}
long long fact(long long x, long long mod) {
  long long r = 1;
  for (int i = 1; i <= x; i++) {
    r = r * i % mod;
  }
  return r;
}
long long C(long long n, long long k) {
  return fact(n) / fact(n - k) / fact(k);
}
long long C(long long n, long long k, long long mod) {
  return fact(n, mod) * fastpow(fact(n - k, mod), mod - 2, mod) % mod *
         fastpow(fact(k, mod), mod - 2, mod) % mod;
}
template <class T>
T gcd(T a, T b) {
  if (a == -1) return b;
  if (b == -1) return a;
  while (b > 0) {
    a = a % b;
    a += b;
    b = a - b;
    a = a - b;
  }
  return a;
}
