#include <bits/stdc++.h>
int main() {
  int t, k, l, i;
  scanf("%d", &t);
  for (k = 0; k < t; k++) {
    int n, c = 0, a = 0, o = 0;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);
    int ans = n;
    for (l = 0; l < n; l++) {
      if (s[l] == '>')
        c++;
      else if (s[l] == '<') {
        a++;
        s[l] = '>';
      } else if (s[l] == '-')
        o++;
    }
    if (c == 0 || a == 0) {
      printf("%d\n", n);
    } else {
      for (i = 0; i < n; i++) {
        if (s[i] == '>' && s[(i + 1) % n] == '>') ans--;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
