Program for checking if a string contains properly matched and nested brackets.