#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string s;
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n;
    cin >> s;
    long long x = 0, y = 0, z = 0, cnt = 0;
    s += s[0];
    for (int j = 0; j < n; j++) {
      if (s[j] == '>') {
        x++;
      }
      if (s[j] == '<') {
        y++;
      }
      if (s[j] == '-' || s[j + 1] == '-') {
        z++;
      }
    }
    if (x == 0 || y == 0) {
      cnt = n;
    } else {
      cnt = z;
    }
    cout << cnt << endl;
  }
  return 0;
}
