#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    bool c = false;
    bool cc = false;
    for (int i = 0; i < n; i++) {
      if (s[i] == '>') c = true;
      if (s[i] == '<') cc = true;
    }
    if (c && cc) {
      long long count = 0;
      s = s + s[0];
      for (int i = 0; i < n; i++) {
        if (s[i] == '-' || s[i + 1] == '-') count++;
      }
      cout << count << "\n";
    } else
      cout << n << "\n";
  }
  return 0;
}
