<filename>BOOK/MAIN/06-recursion/chapter-6-examples/03-reverse-string-using-recursion.py
#printing a string backwards using Recursion

def reverseStringRecursion(sentence,length):
    if length == 0:
        print(sentence[0])
    if length > 0:
        print(sentence[length],end ="")
        return reverseStringRecursion(sentence,length-1)

print("Enter a string: ")
inputString = input()
size = len(inputString)
print("Reverse of String",inputString,"is",reverseStringRecursion(inputString,size-1))

<filename>BOOK/MAIN/06-recursion/chapter-6-examples/03-reverse-string-using-recursion.py
#printing a string backwards using Recursion

def reverseStringRecursion(sentence,length):
    if length == 0:
        print(sentence[0])
    if length > 0:
        print(sentence[length],end ="")
        return reverseStringRecursion(sentence,length-1)

print("Enter a string: ")
inputString = input()
size = len(inputString)
print("Reverse of String",inputString,"is",reverseStringRecursion(inputString,size-1))

#printing a string backwards using Recursion