#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < n; i++)
      if (s[i] == '<')
        cnt1++;
      else if (s[i] == '>')
        cnt2++;
    if (cnt1 == 0 || cnt2 == 0) {
      cout << n << "\n";
      continue;
    }
    int res = 0;
    if (s[0] == '-' || s[n - 1] == '-') res++;
    for (int i = 1; i < n; i++)
      if (s[i] == '-' || s[i - 1] == '-') res++;
    cout << res << "\n";
  }
  return 0;
}
