LearnPy Hub
← Arena
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
solution.py
Output appears here
Score of Brackets · Python Arena problem · LearnPy Hub