Given a string consisting of parentheses, your task is to obtain a well-formed string by changing the minimum number of characters. Deleting or inserting characters is not allowed.
There are three types of parentheses: round , square , and curly . Each pair consists of an opening parenthesis (, , ) and a closing parenthesis (, , ).
A well-formed string is defined by the following rules:
The empty string is well-formed.
If is a well-formed string, then , , and are also well-formed.
If and are well-formed strings, then their concatenation is also well-formed.
As examples, the strings "([{}])", "", and "(){}[]" are well-formed, while "([}])", "([)]", and "{" are not. For the given string, find the minimum number of changes required to obtain a well-formed string.
Each line contains a string with an even number of symbols: , , , , , . The length of each line does not exceed .
For each line, output a single integer: the minimum number of characters that must be changed to make the string well-formed, each on a separate line.
Example 1