10835 - EEDS Brackets and quotation marks   

Description

We want a program to check whether the brackets and quotation marks in our strings are balanced or not.  By "balanced" we mean each opening bracket (quotation mark) has a corresponding closing bracket (quotation mark), and brackets (quotation marks) are properly nested.  The program only needs to check the following six types of characters:

opening curly bracket    {   
closing curly bracket }
opening square bracket [
closing square bracket ]
opening round bracket (
closing round bracket )
opening/closing double quoatation mark "
opening/closing single quoatation mark '

 

For spaces and other characters in a string, our program can ignore them. 

The following exampling strings are not balanced:  

strings notes
 ( a [ b ) ] clearly, the square brackets are not properly nested with others
 a " ( ' b ) c " '   clearly, the single quoation marks are not properly nested with others
 { " a ' ' " bcd The first opening curly bracket does not has a corresponding closing bracket

 

 

Input

There are more than one lines, each line being a string for our program to check. 

Please note that all the characters of an input line belong to the string.  Please do not view the line as a C/C++/Python string in which single and double qouatation marks stand for delimiters. 

Output

For each string in the input, if the string is good, please output "OK", followed by a colon mark and a space, then the string. 

Otherwise, please output "NG", followed by a colon mark and a space, then the string. 

Sample Input  Download

Sample Output  Download

Tags




Discuss