I tried this code but I don't know how input the characters one per line and how to stop the input sequence with the character 0.
def reverse(string):
    if len(string) == 0:
        return string
    else:
        return reverse(string[1:]) + string[0]
a = str(input())
print(reverse(a))
 
     
     
    