#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, n;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    bool a = 0, b = 0;
    for (char c : s) {
      if (c == '<') a = 1;
      if (c == '>') b = 1;
    }
    if (a && b) {
      int cnt = 0;
      if (s[0] == '-' || s[n - 1] == '-') cnt++;
      for (int i = 1; i < n; i++) {
        if (s[i] == '-' || s[i - 1] == '-') cnt++;
      }
      cout << cnt << '\n';
    } else
      cout << n << '\n';
  }
}
