Ixigo.com Interview Question

reverse string logic