#include <bits/stdc++.h>
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const int maxn = 2e6 + 7;
const int INF = 0x3f3f3f3f;
const long long INFF = 1e18;
int t, n;
char s[maxn];
bool mark1, mark2, Can[maxn];
int main() {
  scanf("%d", &t);
  while (t--) {
    mark1 = mark2 = true;
    scanf("%d", &n);
    for (int i = 0; i <= n; i++) Can[i] = false;
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++) {
      if (s[i] == '>') mark2 = false;
      if (s[i] == '<') mark1 = false;
      if (s[i] == '-') Can[i % n] = Can[i - 1] = true;
    }
    if (mark1 || mark2)
      printf("%d\n", n);
    else {
      int cnt = 0;
      for (int i = 0; i <= n - 1; i++)
        if (Can[i]) cnt++;
      printf("%d\n", cnt);
    }
  }
  return 0;
}
