#include <bits/stdc++.h>
using namespace std;
bool good(string x) {
  string a = x;
  string b = x;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == '-') a[i] = '>';
    if (x[i] == '-') b[i] = '<';
  }
  if (count(a.begin(), a.end(), '<') == 0) return true;
  if (count(b.begin(), b.end(), '>') == 0) return true;
  return false;
}
void solve() {
  int n;
  cin >> n;
  string x;
  cin >> x;
  if (good(x))
    cout << n << "\n";
  else {
    set<int> ans;
    for (int i = 0; i < n; i++) {
      if (x[i] == '-') {
        ans.insert(i);
        ans.insert((i + 1) % n);
      }
    }
    cout << ans.size() << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  cin >> testcase;
  for (int i = 1; i <= testcase; i++) {
    solve();
  }
  return 0;
}
