#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("O2")
#pragma GCC optimize("Og")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
using namespace std;
using namespace std;
long long MOD = 998245709;
long long exp(long long n, long long e) {
  if (e == 0) return 1;
  long long temp = exp((n * n) % MOD, e / 2);
  return e % 2 == 0 ? temp : (temp * n) % MOD;
}
long long inverse(long long n) { return exp(n, MOD - 2); }
void frac(long long p, long long q) { cout << (p * inverse(q)) % MOD << endl; }
long long ceil_div(long long a, long long b) { return (a + b - 1) / b; }
int n;
vector<vector<long long>> op;
void operation(vector<long long> &arr, int d1, int d2, int d3, int d4) {
  vector<long long> ans(n + 1);
  d4 = d4 - d3;
  d3 = d3 - d2;
  d2 = d2 - d1;
  vector<long long> vec;
  if (d1 > 0) vec.push_back(d1);
  if (d2 > 0) vec.push_back(d2);
  if (d3 > 0) vec.push_back(d3);
  if (d4 > 0) vec.push_back(d4);
  op.push_back(vec);
  for (int i = 1; i <= d4; i++) {
    ans[i] = arr[d1 + d2 + d3 + i];
  }
  for (int i = 1; i <= d3; i++) {
    ans[d4 + i] = arr[d1 + d2 + i];
  }
  for (int i = 1; i <= d2; i++) {
    ans[d4 + d3 + i] = arr[d1 + i];
  }
  for (int i = 1; i <= d1; i++) {
    ans[d4 + d3 + d2 + i] = arr[i];
  }
  arr = ans;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < ((long long)(s).size()); i++) {
    a += (s[i] == '>');
    b += (s[i] == '<');
    c += (s[i] == '-');
  }
  if (a == 0 || b == 0) {
    cout << n << endl;
    return;
  }
  vector<long long> ans(n, 0);
  for (int i = 0; i < ((long long)(s).size()); i++) {
    if (s[i] == '-') {
      ans[i] = 1;
      ans[(i + 1) % n] = 1;
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) count += ans[i];
  cout << count << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
