#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    string s;
    cin >> s;
    long long int sum = 0;
    long long int a = 0, b = 0, c = 0;
    for (int i = 0; i < n; i++) {
      int x1 = i - 1;
      if (x1 < 0) x1 = n - 1;
      int x2 = (i + 1) % n;
      if (s[i] == '-') a++;
      if (s[i] == '<') b++;
      if (s[i] == '>') c++;
      if (s[i] == '-' || s[x1] == '-') sum++;
    }
    if (b == 0 || c == 0) {
      cout << n << endl;
      continue;
    }
    cout << sum << endl;
  }
  return 0;
}
