G. 0xmar Unique Arrows
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given a string $$$S$$$ consisting only of the characters -, <, and >.

Your task is to construct as many arrows as possible using the characters from the string. An arrow is defined as either the string -> or the string <-.

You can pick characters from any position in the string $$$S$$$ to form an arrow. Each character from the string can be used at most once. You do not have to use all the characters in $$$S$$$.

Formally output the maximum number of pairs such that pair $$$(i,j) , (1 \leq i \lt j \leq |S| )$$$ and s[i]+s[j] is either -> or <-.

an index can be used in at most one pair. $$$|S|$$$ denotes the size of the string

Input

The first line contains a single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — denotes the number of test cases.

The first line and only of each test case contains the string $$$S$$$ ($$$1 \le \vert{}S\vert{} \le 2 \cdot 10^5$$$), consisting only of the characters -, <, and >.

It is guaranteed that the sum of $$$\vert{}S\vert{}$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$

Output

For each test case, output a single integer — the maximum number of arrows you can form.

Example
Input
7
-->-
<->-
>>>---
<--->
----
><<
>--<-->
Output
1
2
0
2
0
0
2
Note

for the second testcase the two pairs are $$$(1,4)$$$ and $$$(2,3)$$$