#include <bits/stdc++.h>
using namespace std;
void dbg(long long a) { cout << "Hello " << a << endl; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<char> dirs(n, 0);
    for (long long i = 0; i < n; i++) {
      cin >> dirs[i];
    }
    vector<int> states(n, 0);
    queue<int> qq;
    bool great = false;
    bool less = false;
    int ans = 0;
    for (long long i = 0; i < n; i++) {
      if (dirs[i] == '-' || dirs[(i - 1 + n) % n] == '-') {
        ans++;
        states[i] = 1;
      }
      if (dirs[i] == '>') {
        great = true;
      } else if (dirs[i] == '<') {
        less = true;
      }
    }
    if (great == true && less == true) {
      cout << ans << endl;
    } else {
      cout << n << endl;
    }
  }
  return 0;
}
