Pregunta de entrevista de J.P. Morgan

How to print reverse integer and string?