#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int i, j, n;
    cin >> n;
    string s;
    cin >> s;
    bool clk = 0, aclk = 0;
    for (i = 0; i < n; i++) {
      if (s[i] == '>')
        clk = true;
      else if (s[i] == '<')
        aclk = true;
    }
    if (!clk || !aclk)
      cout << n << "\n";
    else {
      long long int ans = 0;
      s += s[0];
      for (i = 0; i < n; i++) {
        if (s[i] == '-' || s[i + 1] == '-') ans++;
      }
      cout << ans << "\n";
    }
  }
}
