#include <bits/stdc++.h>
using namespace std;
int main() {
  int cases;
  cin >> cases;
  while (cases) {
    cases--;
    int n;
    cin >> n;
    char arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int countdash = 0, countgreater = 0, countlesser = 0;
    for (int i = 0; i < n; i++) {
      if (arr[i] == '-') {
        countdash++;
      } else if (arr[i] == '>') {
        countgreater++;
      } else if (arr[i] == '<') {
        countlesser++;
      }
    }
    if (countdash == n || countgreater == n || countlesser == n) {
      cout << n << endl;
      continue;
    }
    if (countdash != 0 && countgreater != 0 && countlesser == 0) {
      cout << n << endl;
      continue;
    }
    if (countdash != 0 && countgreater == 0 && countlesser != 0) {
      cout << n << endl;
      continue;
    }
    if (countdash == 0 && countgreater != 0 && countlesser != 0) {
      cout << "0" << endl;
      continue;
    }
    if (countdash != 0 && countgreater != 0 && countlesser != 0) {
      if (arr[0] == '-' && arr[n - 1] == '-') {
        map<int, int> visited;
        int sum = 0;
        int l = 0;
        int x = 0;
        while (arr[l] == '-') {
          visited[l] = true;
          x++;
          l++;
        }
        l = n - 1;
        while (arr[l] == '-') {
          visited[l] = true;
          x++;
          l--;
        }
        sum = x + 1;
        for (int i = 0; i < n; i++) {
          if (arr[i] == '-' && !visited[i]) {
            int c = 1;
            visited[i] = true;
            int j = i + 1;
            while (arr[j] == '-') {
              c++;
              j++;
              visited[j - 1] = true;
            }
            sum = sum + c + 1;
          }
        }
        cout << sum << endl;
      } else {
        map<int, int> visited;
        int sum = 0;
        for (int i = 0; i < n; i++) {
          if (arr[i] == '-' && !visited[i]) {
            int c = 1;
            visited[i] = true;
            int j = i + 1;
            while (arr[j] == '-') {
              c++;
              j++;
              visited[j - 1] = true;
            }
            sum = sum + c + 1;
          }
        }
        cout << sum << endl;
      }
    }
  }
}
