UVa 673 - Parentheses Balance

This is an easy problem. Maintain a stack and when you get an ( or [ push it onto the stack. Then when you get a ) or ] pop (if stack is empty then NO) and compare if they are the corresponding ( or [. Check at the end if the stack is empty.

Also this problem has empty string as valid.

Use fgets to read the strings and the initial number of test cases.