1975: Bracket Matching
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:8
解决:3
题目描述
Assuming that the expression contains three kinds of brackets, they can be nested within each other, such as ([<>]([])) or (<([][()])>) is the correct format, and <[])> or <[()] or [(>) are incorrect formats. Enter a string consisting of these three parentheses, and please program to determine whether they are paired.
输入
enter a positive integer T (T<10), which means there are T cases. Then there are T rows, each with a string consisting of ()<>[].
输出
For each case, output "Case id:" first, then output the number of matching brackets for matching cases, and output "Mismatch" and the length of the string for non-matching cases.
样例输入 复制
10
()
<>)
([)]
)
]
>
(]
())
()[]
([<>])
样例输出 复制
Case 1:1
Case 2:Mismatch,3
Case 3:Mismatch,4
Case 4:Mismatch,1
Case 5:Mismatch,1
Case 6:Mismatch,1
Case 7:Mismatch,2
Case 8:Mismatch,3
Case 9:2
Case 10:3