Given a stream of numbers in the input, you are asked to write a function that would print those numbers in reversed order without using any additional data structures like lists or arrays. The input stops as soon as the number entered is -1.
def rev():
n = int(input())
if n == -1:
return
....
Input
The input contains a stream of numbers (0 β€ β€ ) each on a separate line. Itβs guaranteed that the input contains no more than 1000 lines.
Output
The program should print the numbers in reversed order.