#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int lcnt = 0;
    int rcnt = 0;
    int bcnt = 0;
    set<int> s1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        lcnt++;
      else if (s[i] == '>')
        rcnt++;
      else if (s[i] == '-') {
        bcnt++;
        s1.insert(i % (n));
        s1.insert((i + 1) % n);
      }
    }
    int ans;
    if (lcnt + bcnt == n || rcnt + bcnt == n)
      cout << n << endl;
    else
      cout << s1.size() << endl;
  }
}
