Wrote the convertToRPN method