TopCoder problem "Syntax" used in TCCC '01 Round 2 (Division I Level Two)



Problem Statement

    
Create a class called Syntax. Given a String that contains, among other
characters, parentheses '()', square brackets '[ ]' and curly
 braces '{}',
create a solution that will determine if the string is balanced.  The String is
considered balanced if all of the parentheses,
 brackets, and braces are
nested, opened, and closed properly.  The rules are as follows:

There must be equal numbers of beginning and ending delimiters for each type.
Any time a closing delimiter occurs, it must match the most recent unmatched
open delimiter.
An ending delimiter can never occur without a cooresponding begining delimiter
of the same type.

EXAMPLES:

x(y(z{test})abc)  - should return true
()                - should return true
([)]              - should return false
[[]](()){{{}}}    - should return true
abc(def(ghi)      - should return false

Here is the method signature:
boolean match(String input)

We will check to make sure the input is valid.
 

Definition

    
Class:Syntax
Method:match
Parameters:String
Returns:boolean
Method signature:boolean match(String param0)
(be sure your method is public)
    

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=41

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=2001&pm=41

Writer:

Unknown

Testers:

Problem categories:

String Manipulation