#t431. 括弧匹配检验
括弧匹配检验
Parenthesis Matching Check
Problem Background
Special for beginners, ^_^
Problem Description
Suppose an expression may contain two kinds of brackets: parentheses () and square brackets [], nested in any order, such as ( [ ] ( ) ) or [ ( [ ] [ ] ) ] which are correct matchings, while [ ( ] ), ( [ ] ( ), or ( ( ) ) ) are incorrect matchings.
The problem now is to check whether the brackets in a given expression are correctly matched.
Input a string containing only parentheses and square brackets, and determine whether the brackets match. If they match, output OK; otherwise output Wrong.
Input Format
A single line of characters (fewer than characters).
Output Format
If matched, output OK; otherwise output Wrong. These words must be printed exactly as shown (do not translate).
Sample Input 1
[(])
Sample Output 1
Wrong
Sample Input 2
[([][])]
Sample Output 2
OK
Constraints
Time limit 1s, memory limit 1024KiB for each test case.