#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:

  1. An empty expression is a GBE.
  2. If expression A is a GBE, then [A] and (A) are both GBEs.
  3. If A and B are both GBEs, then AB is 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 100%100\% of the data, the length of the input string is less than 100100.