valid parentheses with stack class