#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long int rvsr(long long int n) {
  string s = to_string(n);
  reverse(s.begin(), s.end());
  stringstream obj(s);
  obj >> n;
  return n;
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int logtwo(long long int n) {
  if (n == 1) return 0;
  return logtwo(n / 2) + 1;
}
long long int isprime(long long int n) {
  for (long long int c1 = 2; c1 * c1 <= n; c1++) {
    if (n % c1 == 0) {
      return 0;
    }
  }
  return 1;
}
long long int twop(long long int n) {
  long long int x = 0;
  while (n % 2 == 0) {
    n /= 2;
    x++;
  }
  return x;
}
long long int t, n, m, k, x, y, flag;
void solve() {
  flag = 0;
  string s;
  long long int d = 0;
  long long int flag1 = 0;
  cin >> m;
  cin >> s;
  set<char> s1;
  for (long long int i = 0; i < s.length(); i++) s1.insert(s[i]);
  if (s1.size() < 3 && !(s1.size() == 2 && (s1.count('>') && s1.count('<'))))
    d = m;
  else {
    for (long long int i = 0; i < m; i++) {
      if (s[i] == '-') {
        d++;
        if (s[i + 1] != '-' && s[(i + 1) % m] != '-') d++;
      }
    }
  }
  if (s1.size() == 2 && (s1.count('>') && s1.count('<'))) flag = 1;
  if (flag)
    cout << "0"
         << "\n";
  else
    cout << d << "\n";
  return;
}
int32_t main() {
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
