#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<')
        c1++;
      else if (s[i] == '>')
        c2++;
    }
    if (c1 == 0 || c2 == 0)
      cout << n << endl;
    else {
      set<int> ans;
      for (int i = 0; i < n; i++) {
        if (s[i] == '-') {
          ans.insert(i);
          ans.insert((i + 1) % n);
        }
      }
      cout << ans.size() << endl;
    }
  }
  return 0;
}
