Олимпиадный тренинг

Задача 34970. Sequence reversal


Задача

Темы: Стек
A sequence of integers ending in zero is entered. The number 0 is not included in the sequence.
Output the elements of the sequence in reverse order. Use a stack to store data.

Input 
A sequence of integers is entered, modulo not exceeding 10000. The input ends when the number 0 is entered. There are no more than 100 numbers in total (not counting zero).

Imprint 
Print the elements of this sequence in reverse order, separated by a space.

 
Examples
# Input Output
1 1 2 3 4 5 0 5 4 3 2 1

Запрещенные операторы:[::-1];reverse