#Q152. 「一本通 5.1 练习 1」括号配对
「一本通 5.1 练习 1」括号配对
Description
Hecy has taken on a new task: BE processing. There is a category in BE called GBE.
The definition of GBE is as follows:
- An empty expression is a GBE.
- If expression
Ais a GBE, then[A]and(A)are both GBEs. - If
AandBare both GBEs, thenABis a GBE.
Given a BE, determine the minimum number of characters that need to be added to make this BE a GBE.
Input Format
The input consists of a single line, the string BE.
Output Format
Output a single integer, representing the minimum number of characters to be added.
Sample 1
[])
1
Data Range and Hint
For of the data, the length of the input string is less than .