#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool one = 1, left = 0, right = 0;
    int pos = -1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        left = 1;
      else if (s[i] == '>')
        right = 1;
      if (i && s[i] != s[i - 1]) pos = i, one = 0;
    }
    if (left && right) {
      int cnt = 0;
      one = 0;
      for (int i = 0; i < n; i++) {
        if (s[(pos + i) % n] == '-') {
          if (!one) {
            one = 1;
            cnt += 2;
          } else {
            cnt++;
          }
        } else
          one = 0;
      }
      cout << cnt << "\n";
    } else {
      cout << n << "\n";
    }
  }
}
