IntermediateRating 1300
Score of Brackets
A balanced bracket string is scored like this: "()" scores 1, AB scores A + B, and (A) scores 2 × A. Print the score.
Input
One balanced string of ( and ).
Output
One integer.
Sample 1
Input
()
Output
1
Sample 2
Input
(())
Output
2
Output appears here