refactor opreator input and operand input code