#include <bits/stdc++.h>
using namespace std;
int main() {
  int tst;
  cin >> tst;
  while (tst--) {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0, bcnt = 0, block = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>')
        cnt++;
      else if (s[i] == '-')
        block++;
      else
        bcnt++;
    }
    set<int> st;
    for (int i = 0; i < n; i++) {
      if (s[i] == '-') {
        st.insert(i);
        st.insert((i + 1) % n);
      }
    }
    int other = n - cnt;
    int bother = n - bcnt;
    if (other == block) {
      cout << n << endl;
    } else if (bother == block) {
      cout << n << endl;
    } else {
      cout << st.size() << endl;
    }
  }
}
