#include <bits/stdc++.h>
using namespace std;
const int N = 300020;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
int T, n;
char x[N];
int main() {
  T = read();
  while (T--) {
    n = read();
    scanf("%s", x);
    int c1 = 0, c2 = 0, c3 = 0;
    for (int i = 0; i < n; i++) {
      if (x[i] == '>') c1++;
      if (x[i] == '<') c2++;
      if (x[i] == '-' || x[(i + 1) % n] == '-') c3++;
    }
    if (c1 != 0 && c2 != 0)
      printf("%d\n", c3);
    else
      printf("%d\n", n);
  }
  return 0;
}
