Ixigo.com interview question

reverse string logic