In C++, consider this program (whose inclusions have been removed):
In Python, consider this program:
Take a look at the sample input and sample output to see what this program prints for every given number.
Without modifying main(), reimplement the procedure work(n) with no calls at all, recursive or not, so that the output of the program does not change.
Input
Input consists of several strictly positive natural numbers.
Output
For every number, print a line identical to the one written by the program above.
Observation
To solve this exercise, the only containers that you should use are stacks.
Input
1 2 3 4
Output
1 2 1 1 3 2 1 1 2 1 1 4 3 2 1 1 2 1 1 3 2 1 1 2 1 1