#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, i, j;
  cin >> n;
  string s;
  cin >> s;
  vector<long long int> v(n, 0);
  for (i = 0; i < n; i++) {
    if (s[(i - 1 + n) % n] == '-' || s[i] == '-')
      v[i] = 1;
    else if (s[(i - 1 + n) % n] != s[i])
      v[i] = -1;
  }
  for (i = 0; i < n; i++) {
    if (v[i] == 0) {
      if (s[i] == '>') {
        j = (i + 1) % n;
        v[i] = -1;
        while (j != i && (s[j] == '>' || s[j] == '-')) {
          if (v[j] == 0) v[j] = -1;
          j++;
          j %= n;
        }
        if (j == i) {
          cout << n << "\n";
          return;
        }
        break;
      } else {
        j = (i - 1 + n) % n;
        v[i] = -1;
        while (j != i && (s[j] == '<' || s[j] == '-')) {
          if (v[j] == 0) v[j] = -1;
          j = (j - 1 + n) % n;
        }
        if (j == i) {
          cout << n << "\n";
          return;
        }
        break;
      }
    }
  }
  long long int ans = 0;
  for (i = 0; i < n; i++) {
    if (v[i] == 1) ans++;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
