#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 1;
const long long PRIME = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long n;
  cin >> n;
  string s;
  bool flag = 1;
  cin >> s;
  long long l = 0, r = 0;
  vector<long long> a(n, 0);
  for (long long i = 0; i < n; i++) {
    if (s[i] == '>')
      l++;
    else if (s[i] == '<')
      r++;
    else {
      a[i] = 1;
      a[(i + 1) % n] = 1;
    }
  }
  if (l != 0 && r == 0) {
    cout << n << "\n";
    return;
  }
  if (r != 0 && l == 0) {
    cout << n << "\n";
    return;
  }
  if (l == 0 && r == 0) {
    cout << n << "\n";
    return;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += a[i];
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
