#include <bits/stdc++.h>
using namespace std;
void solver() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  bool clockwise_connect = true;
  bool anticlockwise_connect = true;
  vector<bool> connected(N, false);
  for (int i = 0; i < N; ++i) {
    char ch = s[i];
    if (ch == '<') {
      clockwise_connect = false;
    }
    if (ch == '>') {
      anticlockwise_connect = false;
    }
    if (ch == '-') {
      connected[i] = true;
      connected[(i + 1) % N] = true;
    }
  }
  if (clockwise_connect || anticlockwise_connect) {
    cout << N << endl;
  } else {
    int ans = 0;
    for (int i = 0; i < N; ++i) {
      if (connected[i]) ++ans;
    }
    cout << ans << endl;
  }
}
int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; ++i) {
    solver();
  }
  return 0;
}
