+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
----------
*(Shoma Khoonatoon Moorche Daare?)*
A straight tunnel without branches is crowded with busy ants coming and going. Some ants walk left to right and others right to left. All ants walk at a constant speed of $1$ cm/s. When two ants meet, they try to pass each other. However, some sections of the tunnel are narrow and two ants cannot pass each other. When two ants meet at a narrow section, they turn around and start walking in the opposite directions. When an ant reaches either end of the tunnel, it leaves the tunnel. The tunnel has an integer length in centimeters. Every narrow section of the tunnel is integer centimeters distant from the both ends. Except for these sections, the tunnel is wide enough for ants to pass each other. All ants start walking at distinct narrow sections. No ants will newly enter the tunnel. Consequently, all the ants in the tunnel will eventually leave it. Your task is to write a program that calculates the summation of all distances walked by the ants.
Figure shows the movements of the ants during the first two seconds in a tunnel $6$ centimeters long. Initially, three ants, numbered $1, 2,$ and $3,$ start walking at narrow sections, $1, 2,$ and $5$ centimeters distant from the left end, respectively. After $0.5$ seconds, the ants $1$ and $2$ meet at a wide section, and they pass each other. Two seconds after the start, the ants $1$ and $3$ meet at a narrow section, and they turn around. Following figure corresponds to the first dataset of the sample input.
![توضیح تصویر](https://quera.org/qbox/view/rwbBtprYqs/L.png)
# ورودی
The input consists one or more datasets. Integer $t$ at the first line indicates the number of datasets.
$$1 \leq t \leq 100$$
There is a string $s$ in each dataset which shows the initial position of ants. $s_i$ indicates the initial state of tunnel at the position $i$. `<` correspond to an ant which is going to left, `>` correspond to an ant which is going to right and `.` means there is no ant at that position.
$$1 \leq |s| \leq 1000$$
# خروجی
For each dataset, print an integer: the summation of total distance walked by the ants, until they exit.
# مثالها
## ورودی نمونه ۱
```
5
.><..<.
.......>
.<......
.....
><
```
## خروجی نمونه ۱
```
12
0
1
0
2
```
?L – Your House Have Ants
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.