#include <cstdio> using namespace std; // ReadAndWriteBackwards() reads a sequence of integers // from the standard input until it reads 0. It writes // those integers (excluding the 0) backwards, one per // line, to the standard output. void ReadAndWriteBackwards() { int n; scanf("%d", &n); if(n != 0) { ReadAndWriteBackwards(); printf("%d\n", n); } } int main() { ReadAndWriteBackwards(); return 0; }