Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 

Chef is instructor of the famous course "Introduction to Algorithms" in a famous univerisity. There are n students in his class. There is not enough space in the class room, so students sit in a long hallway in a linear fashion.

One day Chef was late to class. As a result, some of the students have formed pairs and are talking to each other, while the others are busy studying. This information is given to you by a string s of length n, consisting of characters '*', ', where '*' denotes that the student is studying, '>' denotes that the corresponding student is talking to the student to the right, and 'For example, consider a sample configuration of students - *>>< is also not a valid configuration, as students 2 and 3 are talking to each other, so student 1 won't be able to talk to student 2.

When the students see their teacher coming, those who were talking get afraid and immediately turn around, i.e. students talking to left have now turned to the right, and the one talking to right have turned to the left. When Chef sees two students facing each other, he will assume that they were talking. A student who is busy studying will continue doing so. Chef will call each pair of students who were talking and punish them. Can you find out how many pairs of students will get punished?

For example, in case *>*>, Chef sees that student 2 and 3 are talking to each other and they will be punished.

------ Input ------ 

The first line of the input contains an integer T denoting the number of the test cases.
Each test case contains a string s denoting the activities of students before students see Chef entering the class.

------ Output ------ 

For each test case, output a single integer denoting the number of pairs of students that will be punished.

------ Constraints ------ 

1 ≤ T ≤ 10
1 ≤ |s| ≤ 10^{5}

------ Subtasks ------ 

Subtask #1: (30 points)

1 ≤ T ≤ 10
1 ≤ |s| ≤ 10^{5}
No student is studying.
 
Subtask #2: (70 points)

Original Constraints.

----- Sample Input 1 ------ 
4
><
*><*
><
*><*
----- Sample Output 1 ------ 
0
0
1
2
----- explanation 1 ------ 
Example case 1. The updated configuration will be . No students are talking to each other, so no one will be punished.
Example case 2 and 3. These examples are already explained in the problem statement.