Pregunta de entrevista de Microsoft

Code a function which output an integer or a double when a string representing a number is given as input.