#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    int nLund0 = 0;
    int nRund0 = 0;
    int n00 = 0;
    int nL = 0;
    int nR = 0;
    auto zaehle = [&](char c1, char c2) -> void {
      if ((c1 == '>' && c2 == '-') || (c2 == '>' && c1 == '-')) nRund0++;
      if ((c1 == '<' && c2 == '-') || (c2 == '<' && c1 == '-')) nLund0++;
      if (c1 == '>' && c2 == '>') nR++;
      if (c1 == '<' && c2 == '<') nL++;
      if (c1 == '-' && c2 == '-') n00++;
    };
    cin >> n;
    char c1 = 0, c2 = 0;
    char c0;
    for (int i = 0; i < n; ++i) {
      if (i > 0) c1 = c2;
      cin >> c2;
      if (i == 0) {
        c0 = c2;
        continue;
      }
      zaehle(c1, c2);
    }
    zaehle(c2, c0);
    cout << nRund0 + nLund0 + n00 + nL * ((nLund0 + nL + n00) == n ? 1 : 0) +
                nR * ((nRund0 + nR + n00) == n ? 1 : 0)
         << endl;
  }
}
