#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = 1e18;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool l = 0, r = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        l = 1;
      else if (s[i] == '>')
        r = 1;
    }
    if (l + r < 2)
      cout << n << endl;
    else {
      int ans = n;
      for (int i = 0; i < n; i++) {
        if (s[i] != '-' && s[(i + 1) % n] != '-') ans--;
      }
      cout << ans << endl;
    }
  }
  return 0;
}
