updated reverse polish notation solution