#include <bits/stdc++.h>
using namespace std;
int main() {
  int p;
  cin >> p;
  while (p--) {
    int n, x = 0, y = 0;
    cin >> n;
    string s;
    cin >> s;
    set<int> a;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') x++;
      if (s[i] == '<') y++;
      if (s[i] == '-') {
        a.insert(i);
        a.insert((i + 1) % n);
      }
    }
    if (x == 0 || y == 0)
      cout << n << "\n";
    else
      cout << a.size() << "\n";
  }
}
