#include <bits/stdc++.h>
using namespace std;
char c[300005];
int nrquiz;
int main() {
  cin >> nrquiz;
  while (nrquiz--) {
    int n;
    cin >> n;
    vector<bool> ok(n, 0);
    bool all_same = 1;
    char x = 'a';
    for (int i = 0; i < n; ++i) {
      cin >> c[i];
      if (c[i] != '-') {
        if (x == 'a') {
          x = c[i];
        } else {
          if (c[i] != x) {
            all_same = 0;
          }
        }
      }
    }
    if (all_same) {
      cout << n << '\n';
      continue;
    } else {
      if (c[n - 1] == '-') {
        ok[n - 1] = ok[0] = 1;
      }
      for (int i = 0; i < n; ++i) {
        if (c[i] == '-') {
          ok[i] = ok[i + 1] = 1;
        }
      }
      int ans = 0;
      for (int i = 0; i < n; ++i) {
        if (ok[i] == 1) {
          ans++;
        }
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
