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