Hide

Problem G
Gangur

Languages en is
/problems/gangur/file/statement/en/img-0001.jpg
Hallway by Chuttersnap, Unsplash
Several people are walking through a narrow hallway. When two people meet they have to turn to the side to pass each other. The hallway is split into sections. In some sections there is a person and some sections are empty. Each person is facing either end of the hallway and they all walk at the same speed. How many people have had to pass each other when all individuals have walked to their end of the hallway?

Input

The input consists of a single line describing the contents of all the section of the hallway. The hallway is at least $1$ section and at most $10^6$ sections. If the hallway is described by > then there is a person there facing right. If the hallway is described by < then there is a person there facing left. If the hallway is described by - then there is no person there.

Output

The output should contain a single integer, the number of times two people pass each other in the hallway.

Scoring

Group

Points

Constraints

1

25

The only section described by > is the first section

2

25

All > are to the left of <

3

25

There are at most $1\, 000$ sections

4

25

No further constraints

Sample Input 1 Sample Output 1
>-<-<<-<
4
Sample Input 2 Sample Output 2
>->>-->-<<-<<<
20
Sample Input 3 Sample Output 3
<><-<->-<
4

Please log in to submit a solution to this problem

Log in