#include <bits/stdc++.h>
using namespace std;
class Graph {
  int V;
  list<int> *adj;
  void topologicalSortUtil(int v, bool visited[], stack<int> &Stack);
  int DFSUtil(int v, bool visited[]);

 public:
  Graph(int V);
  void addEdge(int v, int w);
  void topologicalSort(vector<int> &res);
  int DFS(vector<int> &v);
};
Graph::Graph(int V) {
  this->V = V;
  adj = new list<int>[V];
}
void Graph::addEdge(int v, int w) { adj[v].push_back(w); }
void Graph::topologicalSortUtil(int v, bool visited[], stack<int> &Stack) {
  visited[v] = true;
  list<int>::iterator i;
  for (i = adj[v].begin(); i != adj[v].end(); ++i)
    if (!visited[*i]) topologicalSortUtil(*i, visited, Stack);
  Stack.push(v);
}
void Graph::topologicalSort(vector<int> &res) {
  stack<int> Stack;
  bool *visited = new bool[V];
  for (int i = 0; i < V; i++) visited[i] = false;
  for (int i = 0; i < V; i++)
    if (visited[i] == false) topologicalSortUtil(i, visited, Stack);
  int last = 0;
  res[last] = Stack.top();
  Stack.pop();
  while (Stack.empty() == false) {
    ++last;
    res[last] = Stack.top();
    Stack.pop();
  }
}
int Graph::DFSUtil(int v, bool visited[]) {
  visited[v] = true;
  int res = 1;
  list<int>::iterator i;
  for (i = adj[v].begin(); i != adj[v].end(); ++i)
    if (!visited[*i]) res += DFSUtil(*i, visited);
  return res;
}
int Graph::DFS(vector<int> &v) {
  bool *visited = new bool[V];
  for (int i = 0; i < V; i++) visited[i] = false;
  int res = 0;
  for (int i = 0; i < V; i++)
    if (visited[v[i]] == false) {
      int temp = DFSUtil(v[i], visited);
      if (temp > 1) {
        res += temp;
      }
    }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (int z = 0; z < t; ++z) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    Graph g(n);
    Graph g_r(n);
    for (int i = 0; i < n; ++i) {
      int b = (i + 1) % n;
      if (s[i] == '-' || s[i] == '>') {
        g.addEdge(i, b);
        g_r.addEdge(b, i);
      }
      if (s[i] == '-' || s[i] == '<') {
        g.addEdge(b, i);
        g_r.addEdge(i, b);
      }
    }
    vector<int> v(n);
    g_r.topologicalSort(v);
    vector<bool> visited(n, false);
    int res = g.DFS(v);
    cout << res << '\n';
  }
  return 0;
}
