Perhaps today and/or tomorrow due to a power outage there may be disruptions in the work of Codeforces and Polygon. Please do not plan any important events during this time. If there are details or the exact time, we will definitely publish them. Estimated time of maintenance: from 2 Aug, 16:00 (UTC) to 2 Aug, 20:00 (UTC).
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Belted Rooms

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputIn the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$$$ and $$$2$$$, $$$\ldots$$$, $$$n-2$$$ and $$$n-1$$$, $$$n-1$$$ and $$$0$$$ are connected with conveyor belts.

The $$$i$$$-th conveyor belt is in one of three states:

- If it is clockwise, snakes can only go from room $$$i$$$ to $$$(i+1) \bmod n$$$.
- If it is anticlockwise, snakes can only go from room $$$(i+1) \bmod n$$$ to $$$i$$$.
- If it is off, snakes can travel in either direction.

Above is an example with $$$4$$$ rooms, where belts $$$0$$$ and $$$3$$$ are off, $$$1$$$ is clockwise, and $$$2$$$ is anticlockwise.

Each snake wants to leave its room and come back to it later. A room is returnable if the snake there can leave the room, and later come back to it using the conveyor belts. How many such returnable rooms are there?

Input

Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows.

The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms.

The next line of each test case description contains a string $$$s$$$ of length $$$n$$$, consisting of only '<', '>' and '-'.

- If $$$s_{i} = $$$ '>', the $$$i$$$-th conveyor belt goes clockwise.
- If $$$s_{i} = $$$ '<', the $$$i$$$-th conveyor belt goes anticlockwise.
- If $$$s_{i} = $$$ '-', the $$$i$$$-th conveyor belt is off.

It is guaranteed that the sum of $$$n$$$ among all test cases does not exceed $$$300\,000$$$.

Output

For each test case, output the number of returnable rooms.

Example

Input

4 4 -><- 5 >>>>> 3 <-- 2 <>

Output

3 5 3 0

Note

In the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement.

In the second test case, all rooms are returnable by traveling on the series of clockwise belts.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/02/2021 19:50:13 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|