Given a sequence of well-formed parentheses that consists only of '(' and
')', our target is to output, for each of the closing parentheses that we
scan from left to right, the location of the corresponding open parenthesis.
Remark: We will include some very long sequences of parentheses as our
test cases. If your program cannot pass all the test cases, the most
common reasons are either it contains bugs, or it does not run in linear
time.
There are many cases in the input.
For each case, it is one line with legal brackets.
Input will end with EOF.
1407: length <= 30
1408: length <= 2000
1409: length <= 40000
For each case, output the closing parentheses that we scan from left to right, the location of the corresponding open parenthesis.