The short answer would be that you can't. Various solutions exist, but this is hardly a good place for such a solution.
In your example, the data you read is a string. A string can represent an integer, as well, so whatever the user typed it, you can print right back out. No problems.

Is there anything else you need this multi-type variable for?