#include <bits/stdc++.h>
using namespace std;
bool isprime(long long n) {
  if (n == 1) return true;
  if (n == 2 || n == 3) return true;
  if (n % 2 == 0) return false;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
int gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
set<long long> fac;
void allFactors(long long n) {
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      fac.insert(i);
      if (i != n / i) {
        fac.insert(n / i);
      }
    }
  }
}
bool threefactors(long long n) {
  long long p = sqrt(n);
  if (p * p == n) {
    if (isprime(p))
      return 1;
    else
      return 0;
  } else
    return 0;
}
unsigned int countSetBits(unsigned int n) {
  unsigned int count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
int computeXOR(int n) {
  if (n % 4 == 0) return n;
  if (n % 4 == 1) return 1;
  if (n % 4 == 2)
    return n + 1;
  else
    return 0;
}
long long largest_power(long long N) {
  N = N | (N >> 1);
  N = N | (N >> 2);
  N = N | (N >> 4);
  N = N | (N >> 8);
  N = N | (N >> 16);
  return (N + 1) >> 1;
}
long long fibo(long long n) {
  long double him = (1 + sqrt(5)) / 2;
  return round(pow(him, n) / sqrt(5));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int testcases = 1;
  cin >> testcases;
  while (testcases--) {
    int n, c = 0;
    cin >> n;
    string s;
    cin >> s;
    s += s[0];
    bool cw = 0, acw = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') cw = 1;
      if (s[i] == '<') acw = 1;
    }
    if (cw && acw) {
      for (int i = 0; i < n; i++) {
        if (s[i] == '-' || s[i + 1] == '-') c++;
      }
      cout << c << '\n';
    } else
      cout << n << "\n";
  }
  return 0;
}
