Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Score of Parentheses

A balanced parentheses string scores 1 for '()', A + B for the concatenation AB, and 2 * A for '(A)'. Print the score of the given string.

Constraints

2 <= len(s) <= 50

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.