#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
void Max(int &x, int y) { x = (x > y) ? x : y; }
void Min(int &x, int y) { x = (x < y) ? x : y; }
const int N = 3e5 + 10;
int n;
char s[N];
int l(int x) {
  if (x == 0)
    x = n - 1;
  else
    --x;
  return x;
}
int r(int x) {
  if (x == n - 1)
    x = 0;
  else
    ++x;
  return x;
}
int cnt[N];
int main() {
  int T;
  read(T);
  while (T--) {
    for (int i = 0; i < n; i++) cnt[i] = 0;
    read(n);
    scanf("%s", s);
    bool f1 = 1, f2 = 1;
    for (int i = 0; i < n; i++)
      if (s[i] == '>') {
        f1 = 0;
        break;
      }
    for (int i = 0; i < n; i++)
      if (s[i] == '<') {
        f2 = 0;
        break;
      }
    for (int i = 0; i < n; i++)
      if (s[i] == '-') cnt[i] = 1, cnt[r(i)] = 1;
    int ans = 0;
    for (int i = 0; i < n; i++)
      if (cnt[i]) ++ans;
    if (f1 | f2)
      printf("%d\n", n);
    else
      printf("%d\n", ans);
  }
  return 0;
}
