#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string second;
    cin >> second;
    int mi = 0, gr = 0, le = 0, ans = 0;
    for (int i = 0; i < second.length(); i++) {
      if (second[i] == '-')
        mi++;
      else if (second[i] == '>')
        gr++;
      else
        le++;
    }
    if (mi == n || gr == n || le == n) {
      cout << n << endl;
      continue;
    }
    if (mi == 0 && gr && le) {
      cout << 0 << endl;
      continue;
    }
    if ((mi && gr && !le) || (mi && le && !gr)) {
      cout << n << endl;
      continue;
    }
    for (int i = 0; i < second.length(); i++) {
      if (second[i] == '-' || second[(i - 1 + n) % n] == '-') ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
