#include <iostream>
using namespace std;
struct Node{
int num;
Node *next;
};
int n;
Node *creat()
{
Node *head,*p1,*p2;
n=0;
p1=p2=new Node;
cin>> p1->num;
head==NULL;
while(p1->num!=0)
{
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=new Node;
cin>>p1->num;
}
p2->next=NULL;
return head;
}
Node *rollback(Node *head)
{
Node *p=head;
Node *q=NULL;
Node *Next;
while(p)
{
Next=p->next;
p->next=q;
q=p;
p=Next;
}
return q;
}
void print(Node *head)
{
while(head)
{
cout<< head->num;
head=head->next;
}
}
int main()
{
Node *head=creat();
Node *q=rollback(head);
print(q);
return 0;
}
02-12
863

02-20
1417
