#include <bits/stdc++.h>
using namespace std;
long long left(long long i, long long n) {
  if (i == 0) return n - 1;
  return i - 1;
}
long long solve(string a, long long n) {
  long long cw = 0;
  long long ccw = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == '-') continue;
    if (a[i] == '<')
      ccw++;
    else
      cw++;
  }
  if (cw == 0 || ccw == 0) return n;
  long long cnt = 0;
  for (long long i = 0; i < n; i++) {
    if (a[left(i, n)] == '-' || a[i] == '-') cnt++;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string a;
    cin >> a;
    cout << solve(a, n) << '\n';
  }
  return 0;
}
