#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    long long int n;
    cin >> n;
    string s;
    cin >> s;
    int l = s.length();
    int count1 = 0, count2 = 0;
    vector<long long int> multi(n);
    long long int ans = 0;
    for (int j = 0; j < l; j++) {
      if (s[j] == '-') {
        multi[j]++;
        int x = (j + 1) % n;
        multi[x]++;
      }
      if (s[j] == '>') {
        count1++;
      }
      if (s[j] == '<') {
        count2++;
      }
    }
    if (count1 == 0 || count2 == 0) {
      cout << n;
      cout << "\n";
    } else {
      for (int k = 0; k < l; k++) {
        if (multi[k] != 0) {
          ans++;
        }
      }
      cout << ans;
      cout << "\n";
    }
  }
}
