my impelementation of using Stack data type to match braces