#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool r = 1, l = 1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') {
        l = false;
      }
      if (s[i] == '<') {
        r = false;
      }
    }
    if (r || l) {
      cout << n << endl;
    } else {
      int cnt = 0;
      for (int i = 0; i < n; i++) {
        if (s[i] == '-' || s[(i - 1 + n) % n] == '-') {
          cnt++;
        }
      }
      cout << cnt << endl;
    }
  }
  return 0;
}
