#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long ans = 0;
    bool f = 0;
    bool f1 = 0;
    for (long long i = 0; i < n; ++i) {
      if (s[i] == '>') f = 1;
      if (s[i] == '<') f1 = 1;
    }
    if (f && f1) {
      long long ct = 0;
      long long ma = 0;
      vector<long long> v;
      long long st = 0;
      for (long long i = 0; i < n; ++i) {
        if (s[i] != '-') {
          st = i;
          break;
        }
      }
      for (long long i = st + 1; i < 2 * n; ++i) {
        if (i % n == st) break;
        if (s[i % n] == '-') {
          ct++;
        } else {
          if (ct != 0) v.push_back(ct + 1);
          ct = 0;
        }
      }
      if (ct != 0) v.push_back(ct + 1);
      for (long long i : v) ma += i;
      cout << min(ma, n) << "\n";
    } else {
      cout << n << "\n";
    }
  }
}
