#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 7;
int n, m, t;
int main() {
  cin >> t;
  while (t--) {
    string s;
    cin >> n >> s;
    long long sum = 0;
    map<char, int> m;
    for (int i = 0; i < s.size(); i++) {
      m[s[i]]++;
    }
    if (m['<'] && m['>']) {
      long long cnt = 0, f = 0;
      for (int i = 0; i < s.size(); i++) {
        if (s[i] != '-') {
          sum++;
          f = 1;
        } else if (f) {
          sum--;
          f = 0;
        }
      }
      if (f && s[0] == '-') sum--;
    }
    cout << n - sum << endl;
  }
  return 0;
}
