#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const long long mod = 1e9 + 7;
const int alphabet = 26;
const int inf = INT_MAX;
const long long linf = 1e18 + 9;
namespace util {
inline long long cnm(char ch) { return (ch - '0'); }
inline long long cap(char ch) { return (ch - 'a'); }
inline void instr(string& s, long long& n) {
  cin >> s;
  n = s.length();
}
inline void instr(string& s) { cin >> s; }
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
bool min(T a, T b, T c) {
  return std::min(a, std::min(b, c));
}
}  // namespace util
using namespace util;
void solve(int);
void editorial();
void try1();
void try2();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  int i = 1;
  cin >> t;
  while (i <= t) {
    solve(i);
    i++;
  }
  return 0;
}
void try1() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, m, n;
  string s;
  cin >> n;
  cin >> s;
  bool hascw = false;
  bool hasccw = false;
  for (auto& it : s) {
    if (it == '>') hascw = true;
    if (it == '<') hasccw = true;
  }
  int ans = 0;
  if (hascw and hasccw) {
    s += s[0];
    for (int i = 0; i < n; i++) {
      if (s[i] == '-' or s[i + 1] == '-') ans++;
    }
    cout << ans << "\n";
    return;
  }
  cout << n << "\n";
}
void solve(int tc) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, m, n;
  try1();
}
void editorial() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, m, n;
}
void try2() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, m, n;
}
