#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 34;
inline void dbg() { cerr << endl; }
template <typename T, typename... V>
inline void dbg(T t, V... v) {
  cerr << ' ' << t;
  dbg(v...);
}
void solve() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int cnt = 0;
  if (count(str.begin(), str.end(), '>') + count(str.begin(), str.end(), '-') ==
          n ||
      count(str.begin(), str.end(), '<') + count(str.begin(), str.end(), '-') ==
          n) {
    cout << n << endl;
    return;
  }
  for (int i = 0; i <= n - 1; i++) {
    if (str[i] == '-' || str[(i + 1) % n] == '-') {
      cnt++;
    }
  }
  cout << cnt << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
