#include <bits/stdc++.h>
using namespace std;
char a[300008] = {0};
int b[300008] = {0};
int main() {
  int T{0};
  cin >> T;
  while (T--) {
    int n, R = 0, L = 0, N = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      a[i] = 0;
      b[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      if (a[i] == '-') {
        b[i] += 2;
        b[(i + 1) % n] += 2;
      }
      if (a[i] == '>') R = 1;
      if (a[i] == '<') L = 1;
    }
    int sum1{0}, sum2{0};
    for (int i = 0; i < n; i++) {
      if (b[i] >= 2) sum1++;
    }
    if (R && L) {
      cout << sum1 << endl;
    } else {
      cout << n << endl;
    }
  }
  return 0;
}
