#include <iostream>
using namespace std;
struct LinkNode
{
int data;
LinkNode *next;
};
void init(LinkNode *&head)
{
head=new LinkNode;
head->next=NULL;
}
void create(LinkNode *&head)
{
int i;
cin>>i;
if(i==0)
head->next=NULL;
else
{
head->next=new LinkNode;
head->next->data=i;
create(head->next);
}
}
void show(LinkNode *head)
{
if(head->next)
{
cout<<head->next->data<<" ";
show(head->next);
}
}
int main()
{
LinkNode *head;
init(head);
create(head);
show(head);
return 0;
}
using namespace std;
struct LinkNode
{
int data;
LinkNode *next;
};
void init(LinkNode *&head)
{
head=new LinkNode;
head->next=NULL;
}
void create(LinkNode *&head)
{
int i;
cin>>i;
if(i==0)
head->next=NULL;
else
{
head->next=new LinkNode;
head->next->data=i;
create(head->next);
}
}
void show(LinkNode *head)
{
if(head->next)
{
cout<<head->next->data<<" ";
show(head->next);
}
}
int main()
{
LinkNode *head;
init(head);
create(head);
show(head);
return 0;
}