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