#include <bits/stdc++.h>
bool IsCircular(const std::string &s, const int n) {
  bool isCircular = true;
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    isCircular &=
        ((s[i] == '>' || s[i] == '-') && (s[j] == '>' || s[j] == '-'));
  }
  if (isCircular) return true;
  isCircular = true;
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    isCircular &=
        ((s[i] == '<' || s[i] == '-') && (s[j] == '<' || s[j] == '-'));
  }
  return isCircular;
}
int main() {
  int t;
  std::cin >> t;
  while (t--) {
    int n;
    std::string s;
    std::cin >> n >> s;
    if (IsCircular(s, n))
      std::cout << n << std::endl;
    else {
      int ans = 0;
      for (int i = 0; i < n; i++) {
        int j = (i - 1 + n) % n;
        if (s[i] == '-' || s[j] == '-') ans++;
      }
      std::cout << ans << std::endl;
    }
  }
  return 0;
}
