Simplified nested parenthesis solution