created function to format user input and convert to rpn notation