Investment with stack P45111


Statement
 

pdf   zip

html

Use stacks to reverse sequences of natural numbers.

Input

Input consists of various sequences of natural numbers ended with -1.

Output

For each input sequence, your program must print a line with the numbers in reverse order separated by space.

Public test cases
  • Input

    0 1 2 3 4 5 -1
    10 20 10 20 -1
    3 7 -1
    -1
    42 -1
    

    Output

    5 4 3 2 1 0
    20 10 20 10
    7 3
    
    42
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python