#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, f, g, n, m, k;
long long h[5];
bool used[1000000];
void solve() {
  cin >> a;
  char s;
  int flag = 0;
  memset(used, 0, sizeof(used));
  for (int i = 0; i < a; i++) {
    cin >> s;
    if (s == '-') {
      used[i] = 1;
      used[(i + 1) % a] = 1;
    }
    if (s == '<') {
      if (flag == 0 || flag == 1)
        flag = 1;
      else
        flag = 3;
    }
    if (s == '>') {
      if (flag == 0 || flag == 2)
        flag = 2;
      else
        flag = 3;
    }
  }
  if (flag == 1 || flag == 2) {
    cout << a;
    return;
  } else {
    f = 0;
    for (int i = 0; i < a; i++)
      if (used[i] == 1) f++;
    cout << f;
  }
}
int main() {
  int q;
  cin >> q;
  while (q != 0) {
    q--;
    solve();
    cout << '\n';
  }
}
