#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    string s;
    cin >> n >> s;
    bool l = 0, r = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<') l = 1;
      if (s[i] == '>') r = 1;
    }
    if (l && r) {
      int ans = 0;
      s += s[0];
      for (int i = 0; i < n; i++) {
        if (s[i] == '-' || s[i + 1] == '-') ans++;
      }
      cout << ans << "\n";
    } else
      cout << n << "\n";
  }
}
