#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n;
char s[N];
int main() {
  int t;
  scanf("%d\n", &t);
  while (t--) {
    scanf("%d\n%s", &n, s);
    int f1 = 0, f2 = 0, ans = 0;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        if (s[i] == '-' || s[n - 1] == '-') ans++;
      } else {
        if (s[i] == '-' || s[i - 1] == '-') ans++;
      }
      if (s[i] == '>') f1 = 1;
      if (s[i] == '<') f2 = 1;
    }
    if (f1 + f2 < 2) ans = n;
    printf("%d\n", ans);
  }
  return 0;
}
