#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const double PI = acos(-1);
const long long tam = 7e5;
void solve() {
  int n;
  string txt;
  cin >> n >> txt;
  int c = 0, otroc = 0;
  for (long long i = 0; i < txt.size(); i++) {
    if (txt[i] == '>') c |= 1;
    if (txt[i] == '<') c |= 2;
    if (txt[i] == '-') otroc++;
  }
  if (c != 3) {
    cout << n << endl;
    return;
  }
  c = 0;
  int ult = 2;
  for (long long i = 0; i < n - 1; i++) {
    if (txt[i] == '-')
      c += ult, ult = 1;
    else
      ult = 2;
  }
  if (txt[n - 1] == '-') {
    c += (txt[n - 2] != '-');
    if (txt[0] != '-') c++;
  }
  cout << c << endl;
}
int main() {
  int casos;
  cin >> casos;
  while (casos--) {
    solve();
  }
}
