#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int iscycle = 0;
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '>') {
      a = 1;
    } else if (s[i] == '<') {
      b = 1;
    } else {
    }
  }
  if (a && b) {
  } else {
    iscycle = 1;
  }
  if (iscycle) {
    cout << n << endl;
  } else {
    map<int, int> mp;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '-') {
        if (mp[i] == 0) {
          mp[i]++;
          ans++;
        }
        if (mp[(i + 1) % n] == 0) {
          mp[(i + 1) % n]++;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
