#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s.find('>') == string::npos || s.find('<') == string::npos)
      cout << n << "\n";
    else {
      int ans = 0;
      for (int i = 0; i < n; i++) {
        if (s[i] == '-' || s[(i + 1) % n] == '-') ans++;
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
