Program to reverse a string using API, iterative and recursively