use a stack for left parentheses, linear