You are given a string of only the characters ( and ). You may insert single brackets (either ( or )) at any positions. Find the minimum number of insertions needed to make the whole string valid (every bracket matched and properly nested).
Input format
A single line: a string of ( and ) characters (possibly empty).
Output format
A single integer: the minimum number of bracket insertions required.
Constraints
- 0 <= length of the string <= 100000