#include <bits/stdc++.h>
int n, T;
char s[300001];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%s", &n, s);
    s[n] = s[0];
    bool s1 = true, s2 = true;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') s1 = false;
      if (s[i] == '<') s2 = false;
      if (s[i] == '-' || s[i + 1] == '-') ans++;
    }
    if (s1 || s2)
      printf("%d\n", n);
    else
      printf("%d\n", ans);
  }
}
