#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long int ans = 0;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  ans += a / b;
  return gcd(b, a % b);
}
long long int mod = 1000000007;
long long int fact[300005];
void factorial() {
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i < 300005; ++i) fact[i] = (fact[i - 1] * i) % mod;
  return;
}
long long int binpower(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
bool isPrime(int n) {
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
long long int gprime[10000001];
void grsieve() {
  gprime[1] = 1;
  gprime[0] = 1;
  for (long long int i = 2; i < 10000001; ++i) {
    if (gprime[i] == 0) {
      for (long long int j = i; j < 10000001; j += i) gprime[j] = i;
    }
  }
}
const int maxn = 1e6 + 1;
bool checkprimes[maxn];
vector<long long int> primes;
void primechecker() {
  for (long long int i = 2; i < maxn; ++i) {
    if (checkprimes[i] == false) {
      primes.push_back(i);
      for (long long int j = i; j < maxn; j += i) {
        checkprimes[j] = true;
      }
    }
  }
}
long long int C(int u, int v) {
  long long int c = (fact[v] * fact[u - v]) % mod;
  long long int in = binpower(c, mod - 2);
  long long int res = (in * fact[u]) % mod;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int test = 1;
  cin >> test;
  while (test--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int flag = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '<') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << n << endl;
      continue;
    }
    flag = 0;
    for (int i = n - 1; i >= 0; --i) {
      if (s[i] == '>') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << n << endl;
      continue;
    } else {
      int counter = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == '-' || s[(i - 1 + n) % n] == '-') counter++;
      }
      cout << counter << endl;
    }
  }
  return 0;
}
