#include <stdio.h> #include <iostream> #include <iomanip> using namespace std; typedef struct Tzasobnik Tzasobnik; struct Tzasobnik { int hodnota; Tzasobnik* dalsi; }; void pridej(Tzasobnik* & z, int hodnota) { Tzasobnik* pom; pom=new Tzasobnik; pom->hodnota=hodnota; pom->dalsi=z; z=pom; } bool odeber(Tzasobnik* & z, int & hodnota) { Tzasobnik* pom; if (z!=NULL) { pom=z; z=z->dalsi; hodnota=pom->hodnota; delete pom; return true;} else {return false;} } int main() { int x; Tzasobnik* f=NULL; while (cin >> x) { pridej(f,x);} while (odeber(f,x)) {cout << x << " ";} }