#include <bits/stdc++.h>
using namespace std;
bool com(pair<int, int> x, pair<int, int> y) { return x.first < y.first; }
long long int power(long long int x, long long int y) {
  long long int prod = 1;
  while (y) {
    if (y & 1) prod = (prod * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return prod;
}
const int N = 1e5 + 9;
string s;
void solve() {
  int n;
  cin >> n;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '-' || s[(n + i - 1) % n] == '-') ans++;
  }
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '>')
      x++;
    else if (s[i] == '<')
      y++;
  }
  if (x == 0 || y == 0) ans = n;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
