Brackets Everywhere

Compute the minimum number of brackets you need to insert into an arbitrary sequence of brackets, such that all brackets are matched, and the number of ways of doing so. Two ways are considered different if and only if their corresponding final matched sequences of brackets are different. Note that the empty string is a matching bracket sequence; If S is a matching bracket, then [S] is also a matching bracket; If S, T are matching bracket sequence, then ST is also a matching bracket sequence. Input A number of of inputs (≤ 100) described as follows. Each input is just a single string sequence of brackets consisting of only ‘[’ and ‘]’. The maximum length of the string is 1000 characters. Output For each input, output a line with the minimum number of brackets to insert followed by the number of different ways modulo 1000000007, as described above. Sample Input []] [[]] Sample Output 12 01