#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool a = false, b = false;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        a = right;
      else if (s[i] == '>')
        b = right;
    }
    if (a != b)
      cout << n << endl;
    else if (a == b && a == false)
      cout << n << endl;
    else {
      int a[n];
      memset(a, 0, sizeof(a));
      for (int i = 0; i < n; i++) {
        if (s[i] == '-') {
          a[i] = 1;
          a[(i + 1) % n] = 1;
        }
      }
      int ans = 0;
      for (int i = 0; i < n; i++) {
        ans += a[i];
      }
      cout << ans << "\n";
    }
  }
}
