#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int fact(long long int n) {
  long long int res = 1;
  for (int i = 2; i <= n; ++i) {
    res *= i;
    res %= 1000000007;
  }
  return res;
}
long long int ar[500050];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    long long int n, m, k;
    string s, t;
    cin >> n >> s;
    bool ok = 0, ok1 = 0;
    for (auto c : s) {
      if (c == '>') ok1 = 1;
      if (c == '<') ok = 1;
    }
    if (ok and ok1) {
      s += s[0];
      int cnt = 0;
      for (int i = 0; i < n; i++)
        if (s[i] == '-' or s[i + 1] == '-') cnt++;
      cout << cnt << endl;
    } else
      cout << n << endl;
  }
  return 0;
}
