AdvancedRating 1500
Fewest Inserts to Balance
The string has (, ), [ and ]. Print the fewest bracket characters to insert anywhere so that it becomes properly balanced and nested.
Input
One string (length ≤ 100).
Output
One integer.
Sample 1
Input
([)]
Output
2
Sample 2
Input
((
Output
2
Output appears here