#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string in, temp = "";
    cin >> in;
    for (int i = 0; i < in.length(); i++) {
      if (in[i] != '-') temp += in[i];
    }
    bool ok = true;
    char dir = temp[0];
    for (int i = 1; i < temp.length(); i++) {
      if (dir != temp[i]) {
        ok = false;
        break;
      }
    }
    if (ok) cout << in.length() << endl;
    long long sum = 0;
    int ind = 0;
    vector<bool> vis(n, 0);
    for (int i = 0; i < n; i++) {
      if (in[i] == '-') {
        if (!vis[i]) {
          sum++;
          vis[i] = true;
        }
        if (!vis[(i + 1) % n]) {
          sum++;
          vis[(i + 1) % n] = true;
        }
      }
    }
    if (!ok) cout << (sum == 0 ? 0 : sum) << endl;
  }
}
