semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct num
{int nianling;
float defen;
char q[200],w[100],xingbie,xuehao[200];
struct num *next;
};
struct num *crea()
{long i;
  struct num *head;
  struct num *p1,*p2;
   p1=p2=(struct num *)malloc(LEN);
   head=p1;
   scanf("%s %s %c %d %f %s",&p1->xuehao,&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w);

head->next=NULL;
  for(;;)
    {  
p1=(struct num *)malloc(LEN);
scanf("%s",&p1->xuehao);if(p1->xuehao[0]!='e')      
{scanf("%s %c %d %f %s",&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w);

       p1->next=p2;
       p2=p1;}
else  {p1->next=p2,p2=p1;break;}
       }
   return(p1);
}
void main()
{

long nx,m,m0,tx,qx,q,mxh;
struct num *hi,*p,*t;
hi=crea();
t=hi->next;
for(p=t;p!=NULL;p=p->next)
{printf("%s %s %c %d %g %s\n",p->xuehao,p->q,p->xingbie,p->nianling,p->defen,p->w);
}
}
struct student
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[10];
	char address[50];
	struct student *next;
};
void main()
{
	struct student *head,*p,*s;
	head=(struct student *)malloc(sizeof(struct student));
	head->next=NULL;
    p=head->next;	
	for(;;)
	{
		s=(struct student *)malloc(sizeof(struct student));
		s->next=NULL;
		scanf("%s",s->num);
		if(strcmp(s->num,"end")==0)
			break;
		scanf("%s %c %d %s %s",s->name,&s->sex,&s->age,s->score,s->address);
		head->next=s;
		s->next=p;
		p=s;
	}
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}
struct Student
{
	char no[10];
	char name[20];
	char sex;
	int age;
	char score[7];
	char add[15];
	struct Student *next;
};
int main()
{
	struct Student *p[1000],*head;
	int i;
	for(i=0; ;i++)
	{
		p[i]=(struct Student *)malloc(LEN);
		scanf("%s",p[i]->no);
	
			if(strcmp(p[i]->no,"end")==0)
			{
				head=p[i-1];//head????
				break;//???end???
			}
			else
			{
			getchar();
				scanf("%s %c %d %s %s",p[i]->name,&p[i]->sex,&p[i]->age,p[i]->score,p[i]->add);
			getchar();
				if(i==0)
				{
					p[i]->next=NULL;//????????????????????
				}
				else
				{
					p[i]->next=p[i-1];//????????????????
				}
			}
		
	}
	for(head=head;head!=NULL;head=head->next)
	{
		printf("%s %s %c %d %s %s\n",head->no,head->name,head->sex,head->age,head->score,head->add);
	}
	return 0;
}
struct student 
{
	char num[10];
    char s1[20];
	char sex;
	int age;
	char mark[20];
	char s2[20];
    struct student*next;
   
} *p1,*p2;//????????????????????????//

int n;

//????//

struct student * creat(void)
{
	struct student * head;
    n=0;
    p1 = p2 = (struct student * )malloc(LEN); 
    scanf("%s", p1->num);
   
    while(strcmp(p1->num,"end")!=0)//?????????//
	{
	    
		scanf ("%s %c %d %s %s", p1->s1,&p1->sex, &p1->age, p1->mark, p1->s2);//?????????????//
		n=n+1;
		if (n==1)
        {
			head=p1;//?????????//
		}
        else
        {
			p2->next=p1;
		}
        
        p2=p1;
        p1=(struct student *)malloc(LEN); 
        scanf("%s",p1->num);//??p1->num???while?????//
         
	}
	p2->next=NULL; 
	
	return(head);        
}//?????????????//

struct student * turnback(struct student * head)//??????//
{
	struct student * newhead = NULL;

	struct student * anew;//?????????????????//

    do{
		p2 = NULL;
		p1 = head;
    	while(p1->next !=NULL)
		{
			p2=p1;
			p1=p1->next;
		}  
		if(newhead==NULL)
		{
			newhead = p1;
		    anew = newhead->next = p2;//??anew????????//
		}
		
		anew = anew->next =p2;
		p2->next=NULL;

	}while(head->next !=NULL);

	return newhead;//??????????//
}
//??????//    
void print(struct student *head)
{
	struct student *p;
	p = head;
	if(p !=NULL)
    	do{
			printf("%s %s %c %d %s %s\n", p->num, p->s1, p->sex, p->age, p->mark, p->s2);
			p = p->next;

		}while(p !=NULL);
}
//???//                                                                                    
main()
{
	struct student *head;
	head = creat();

	head = turnback(head);//?????????????//

	print (head);//??????????/
   return 0;
   
}
struct stu
{
	char num[15];
	char name[20];
	char sex;
	int  year;
	char score[20];
	char adr[15];
	struct stu *next;
}*p,*q,*head,*newhead,*ne;

struct stu *creat(void)
{
	char a[15];
	head=null;
	scanf("%s",&a);
	while(strlen(a)!=3)
	{
		p=(struct stu *)malloc(l);
		strcpy(p->num,a);
		scanf("%s %c %d %s %s",p->name,&p->sex,&p->year,p->score,p->adr);
		if(head==null)
			q=head=p;
		else
			q=q->next=p;
		scanf("%s",a);
	}
	q->next=null;
	return (head);
}

struct stu * change(struct stu *head)
{
	newhead=null;
	do
	{
		q=null;
		p=head;
		while(p->next!=null)
		{
			q=p;
			p=p->next;
		}
		if(newhead==null)newhead=p,ne=newhead->next=q;
		ne=ne->next=q;
		q->next=null;
	}while(head->next!=null);
	return (newhead);
}

void output(struct stu *newhead)
{
	p=newhead;
	while(p!=null)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->adr);
		p=p->next;
	}
}
int main()
{
	head=creat();
	newhead=change(head);
	output(newhead);
}
struct stu
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[10];
	char adr[15];
	struct stu *next;
}student;

int i;

struct stu *creat(void)
{
	struct stu *p1,*p2,*head;
	p1=p2=(struct stu *) malloc(sizeof (struct stu));	
	scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
	head=0;
	i=0;
	while(1)
	{
		if(i==0)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct stu *) malloc(LEN);
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
			break;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
		i++;
	}
	return(head);
}
void main()
{
struct stu *p,*head;
	int j;
	head=creat();
	for(;i>0;i--)
	{
		p=head;
		for(j=0;j<i;j++)
		{
			p=p->next;
		}
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
	}
	printf("%s %s %c %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->adr);
}
struct people
{
	char num[20];
	char name[20];
	char sex;
	char age[5];
	char score[10];
	char address[30];
};
struct people child[1000];
void main() 
{
	int i;
	for(i=0;;i++)
	{
		scanf("%s",child[i].num);
		if (strcmp(child[i].num,"end")==0)
			break;
		scanf("%s %c%s%s%s",child[i].name,&child[i].sex,child[i].age,child[i].score,child[i].address);
	}
	for(i--;i>=0;i--)
	{
		printf("%s %s %c %s %s %s\n",child[i].num,child[i].name,child[i].sex,child[i].age,child[i].score,child[i].address);
	}
}
struct student{
       char stu[50];
       struct student *next; 
};

struct student *Create();
void Insert(struct student *head,struct student *newnode);
void Print(struct student *head);

int main(){
	struct student tmp;
	struct student *head;
	
	head=Create();
	gets(tmp.stu);
	while(strcmp(tmp.stu,"end")!=0){
		Insert(head,&tmp);
		gets(tmp.stu);
	}
	Print(head);
	
	return 0;
}

struct student *Create()
{
	struct student *p;
	
	p=(struct student *)malloc(sizeof(struct student));
	strcpy(p->stu,"0"); 
	p->next=NULL;

	return p;
}

void Insert(struct student *head,struct student *tmp)
{
	struct student *p;
	struct student *newnode;
	
	p=head;
	while(p->next!=NULL)
		p=p->next;
	newnode=(struct student *)malloc(sizeof(struct student));
	p->next=newnode;
	strcpy(newnode->stu,tmp->stu);
	newnode->next=NULL;
}

void Print(struct student *head)
{
	if(head->next!=NULL)
		Print(head->next);
	if(strcmp(head->stu,"0")!=0)  
		printf("%s\n",head->stu);
}
main()
{
      struct student
      {
             char num[20];
             char name[20];
             char sex;
             int age;
             float score;
             char ad[20];
             struct student *next;
      };
      
      struct student *head,*p1,*p2;
      int n=0;
      
      p1=p2=( struct student*) malloc(LEN);
      scanf("%s%s %c%d%f%s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,&p1->ad);//??????????? 
      p1->next=NULL;
      head=NULL;
      while  (n!=1)
      {
             p1=(struct student*)malloc(LEN);
             scanf("%s",&p1->num);
             if (strcmp(p1->num,"end")!=0)
             {
             scanf("%s %c%d%f%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->ad);
             p1->next=p2;
             p2=p1;
             }
             else
             n=1;
      }
      
      head=p2;
      p1=head;
      
      while (p1!=NULL)
      {
            printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->ad);
            p1=p1->next;
      }

}
struct sd
{char xh[100];char xm[100];char xb;int nl;double df;char dz[10];struct sd*before;};

struct sd* cre()
{struct sd *p1,*p2=NULL;

while(1){p1=(struct sd*)(malloc(sizeof(struct sd)));

scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)break;
else{  p1->before=p2;p2=p1; 
	scanf("%s %c %d %lf %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);  }}
return p2;
}
void main()
{struct sd*cre();
	struct sd*p=cre();
	while(1){printf("%s %s %c %d %g %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz);
if(p->before==NULL)break; 
else p=p->before; }}
struct student
{
	char stuID[20];
	char name[20];
	char sex;
	int age;
	char score[10];
	char add[20];
};
int main()
{
	int i,j;
	struct student stu[5000];
	scanf("%s %s %c %d %s %s",stu[0].stuID,stu[0].name,&stu[0].sex,&stu[0].age,stu[0].score,stu[0].add);
	i=0;
	if(strlen(stu[i].stuID)>=3)
	{
	while(1)
	{
		i++;
		scanf("%s",stu[i].stuID);
		if(strlen(stu[i].stuID)==3)
			break;
		scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
	}
	//printf("#####3");
	for(j=i-1;j>=0;j--)
	{
		printf("%s %s %c %d %s %s\n",stu[j].stuID,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add);
	}
	}
	return 0;
}
struct student
{
    char data[500];
    struct student *former;
};
int n;
struct student *create()
{
    struct student *tail;
    struct student *p1,*p2;
    n=0;
    p1=p2=(struct student *)malloc(sizeof(struct student));
    gets(p1->data);
    tail=NULL;
    while(strcmp(p1->data,"end")!=0)
    {
        n=n+1;
        if (n==1)
        {
            tail=p1;
            p1->former=NULL;
        }
        else
        {
            tail=p1;
            p1->former=p2;
            p2=p1;
        }
        p1=(struct student *)malloc(sizeof (struct student));
        gets(p1->data);
    }


    return(tail);
}
int main()
{

    struct student *p,*start;
    p=create();
    start=p;
    if (p!=NULL)
    {
        do
        {
            puts(start->data);
            start=start->former;
        }
        while (start!=NULL);
    }
}
int main()
{
	struct student {
		char ID[30];
		char name[30];
		char sex;
		int age;
		float  score;
		char address[20];
	}message[1000];
	int num=0;

	for(;;num++)
	{
		cin>>message[num].ID;
		if (message[num].ID[0]!='e')//??????
		{cin>>message[num].name>>message[num].sex>>message[num].age>>message[num].score>>message[num].address;
		}
		else break;
	}
	for(int i=num-1;i>=0;i--)
		cout<<message[i].ID<<' '<<message[i].name<<' '<<message[i].sex<<' '<<message[i].age<<' '<<message[i].score<<' '<<message[i].address<<endl;
return 0;
}
struct student{
	char xh[20];
	char name[20];
	char sex;
	int age;
	float score;
	char dizhi[30];
	struct student *next;
};
struct student *append(void)
{int n;
 struct student *head,*newnode,*thisnode=NULL;
 for (n=1;;n++)
 {newnode=(struct student*)malloc(sizeof(struct student));
  scanf("%s",&newnode->xh);
  if (newnode->xh[0]=='e')
     {head=thisnode;break;}
  else
     {scanf(" %s %c %d %f %s\n",&newnode->name,&newnode->sex,&newnode->age,&newnode->score,&newnode->dizhi);
      newnode->next=thisnode;
      thisnode=newnode;
     }
 }
 return head;
}
void main()
{struct student *p;
 for ( p=append();p!=NULL;p=p->next)
 {printf("%s %s %c %d %g %s\n",p->xh,p->name,p->sex,p->age,p->score,p->dizhi);
 
 }
}
struct student
{
	char num[50],ming[100];
	struct student *pro;
};
int n;
struct student *tail;

struct student *creat()
{
	struct student *head;
	struct student *p1,*p2;
    int i;
	i=0;
	p1=p2=(struct student *)malloc(len);
	scanf("%s",p1->num);
	head=0;
	while (strcmp(p1->num,"end"))
	{
		gets(p1->ming);
		i++;
		if (i==1) 
		{
			head=p1;
			head->pro=0;
		}
		   else 
		   {
			   p1->pro=p2;
		   }
		p2=p1;
		p1=(struct student *)malloc(len);
		scanf("%s",p1->num);
	}	
	tail=p2;
	return(tail);
}

main()
{
	struct student *p;
	creat();
	p=tail;
	for (;p!=0;)
	{
		printf("%s%s\n",p->num,p->ming);
		p=p->pro;
	}
}
struct stu
{char info[50];
struct stu *next;
}*p1,*p2;
int n;
struct stu *creat(void)
{struct stu *head=NULL;
n=0;
p1=p2=(struct stu *)malloc(sizeof(struct stu));//???????
gets(p1->info);
while(strcmp(p1->info,"end")!=0)
{n++;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct stu *)malloc(sizeof(struct stu));
gets(p1->info);
}
p2->next=NULL;
return (head);
}

struct stu * turnback(struct stu *head)
{
	struct stu *New,*Newhead=NULL;
	do{
		p2=NULL;
		p1=head;
		while(p1->next!=NULL)
		{p2=p1;
		p1=p1->next;
		}
		if(Newhead==NULL)
		{
			Newhead=p1;
			New=Newhead->next=p2;
		}
		New=New->next=p2;
		p2->next=NULL;
	}while(head->next!=NULL);
	return(Newhead);
}
void output(struct stu *head)
{for(p1=head;p1!=NULL;puts(p1->info),p1=p1->next);
}
void main()
{
	struct stu *head;
	head=creat();
	head=turnback(head);
	output(head);
}
struct link
{
	char s[100];
	struct link *next;
	struct link *last;
} ;
struct link *create()
{
	struct link *last,*head,*p;
	char s[100];
	head=(struct link*)malloc(LEN);
	last=head;
	do
	{
		gets(s);
		if (strlen(s)==3) break;
		p=(struct link*)malloc(LEN);
		strcpy(p->s,s);
		last->next=p;
		p->last=last;
		last=p;
	}
	while (0==0);
	last->next=NULL;
	head=head->next;
	head->last=NULL;
	return head;
}
void nprint(struct link *p)
{
	struct link *last;
	while (p!=NULL)
	{
		last=p;
		p=p->next; 
	}
	p=last;
	while (p!=NULL)
	{
		puts(p->s);
		p=p->last;
	}
} 
int main()
{
	struct link *p;
	p=create();
	nprint(p);
}
struct student
{
	char inf[50];
	struct student *next;
};
int main()
{
	struct student *head,*p;
	p=(struct student*)malloc(LEN);
	gets(p->inf);
	head=NULL;
	while (p->inf[0]!='e')
	{
		p->next=head;
		head=p;
		p=(struct student*)malloc(LEN);
		gets(p->inf);
	}
	p=head;
	while(true)
	{
	printf("%s",p->inf);
	p=p->next;
	if (p==NULL)  break;
	else printf("\n");
	}
	return 0;
}
struct student 
{ 
    char id[50]; 
    char name[50]; 
    char sex;
    int age;                  
    double grade;
    char a[20];
    struct student *next;
};


void main() 
{
    struct student *h,*p,*q;
    int n=0;
    p=(struct student*)malloc(LEN);
    scanf("%s",p->id);
    while(p->id[0]!='e')
    {
         scanf("%s %c%d%lf%s",p->name,&p->sex,&p->age,&p->grade,p->a);
         n=n+1;
         if(n==1) p->next=NULL;
         else p->next=h;
         h=p;
         p=(struct student *)malloc(LEN);
         scanf("%s",p->id);
    }
    p=h;
    do
    {
        printf("%s %s %c %d %g %s\n",p->id,p->name,p->sex,p->age,p->grade,p->a);
        p=p->next;
    }
    while(p!=NULL);     
}
struct student
{
	char str[100];
	struct student *next;
};

int isequal(char *a);

int main()
{
	struct student *head,*p1,*p2;
	p1=(struct student*)malloc(sizeof(struct student));
	gets(p1->str);
	p1->next=NULL;
	if(isequal(p1->str))
	{
		free(p1);
		head=NULL;
	}
	else
	{
		head=p1;
		p2=p1;
		do
		{
			p1=(struct student*)malloc(sizeof (struct student));
			gets(p1->str);
			p1->next=NULL;
			if (isequal(p1->str))
			{
				free(p1);
				break;
			}
			else
			{
				head=p1;
				p1->next=p2;
				p2=p1;

			}
		}
		while(1);
	}
	struct student *p;
	p=head;
	while(p)
	{
		printf("%s",p->str);
		p=p->next;
		if (p != NULL)
			printf("\n");
	}
	return 0;
}

int isequal(char *a)
{
	if (a[0] == 'e' && a[1] == 'n' && a[2] == 'd' && a[3] == 0)
		return 1;
	else 
		return 0;
}
struct student
{
	char num[30];
	char name[30];
	char sex;
	int age;
	char score[30];
	char add[30];
	struct student *next;
};
int n=0;
void main()
{
	struct student *head,*p1,*p2;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	while(1)
	{
		n++;
		if(n==1) p1->next=NULL;
		else p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0) break;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	}
	head=p2;
	p1=head;
	printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
	do
	{
		p1=p1->next;
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		
	}
	while(p1->next!=NULL);
}
void main()
{
	struct stu
	{
		char num[21];
		char name[31];
		char sex[2];
		int age;
		float score;
		char address[31];
		struct stu *next;
		struct stu *pre;
	};
	struct stu *head,*p1,*p2,*tail;
	head=(struct stu *)malloc(sizeof(struct stu));
	p1=head;
	p2=p1;
	p1->pre=NULL;
	scanf("%s",&p1->num);
	if (strcmp(p1->num,"end"))
	{
	while(strcmp(p1->num,"end"))
	{
		scanf("%s",&p1->name);
		scanf("%s",&p1->sex);
		scanf("%d",&p1->age);
		scanf("%f",&p1->score);
		scanf("%s",&p1->address);
		p2=(struct stu*)malloc(sizeof(struct stu));
		p1->next=p2;
		p2->pre=p1;
		p1=p2;
		scanf("%s",&p1->num);
	}
	tail=p1->pre;
	free(p1);
	tail->next=NULL;
	p1=tail;
	p2=p1;
	while(p1!=NULL)
	{
		printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p2=p1->pre;
		p1=p2;
	}
	p1=head;
	p2=p1;
	while(p1!=NULL)
	{
		p2=p1->next;
		free(p1);
		p1=p2;
	}
    }
	else
		free(head);
}
struct link
{
	char a[10][100];
	struct link *next;
};
struct link *now,*past;
int i,n=1;
void build()
{
	while (1)
	{
	now=(struct link*)malloc(sizeof(struct link));
	scanf("%s",now->a[0]);
	if (strcmp(now->a[0],"end")==0) return;
	for (i=1;i<6;i++)
		scanf("%s",now->a[i]);
	if (n==1)
	{
		now->next=NULL;
	} else now->next=past;
	past=now;
	n++;
	}
}
void main()
{
	build();
	now=past;
	while (now!=NULL)
	{
		printf("%s",now->a[0]);
		for (i=1;i<6;i++)
			printf(" %s",now->a[i]);
		printf("\n");
		now=now->next;
	}
}
struct student
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[6];
	char addr[20];
	struct student *former;
};
int n;
struct student *create()
{
	n=0;
	struct student *p1,*p2;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s",p1->num);
	while(p2->num[0]!='e')
	{
		n++;
		if(n==1)
			p1->former=NULL;
		else p2->former=p1;
		p1=p2;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
		p2=(struct student*)malloc(LEN);
		scanf("%s",p2->num);
	}
	return(p1);
}
void print(struct student*head)
{
	struct student *p;
	p=head;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
		p=p->former;
	}
}
void main()
{
	struct student *head;
	head=create();
	print(head);
}
struct stu{char id[20];char name[20];char sex;int age;char score[20];char address[20];struct stu *next;struct stu *former;};
struct stu *cr(void)
{struct stu *head,*end;
 struct stu *p1,*p2;
 int i=0;
 p1=p2=(struct stu*)malloc(LEN);
 scanf("%s",&p1->id);
 if(strcmp(p1->id,"end")!=0)
{	 scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);//printf("%s",p1->name);
	 head=NULL;
    	 while(1)
	{
		 i++;
		 if(i==1)  {head=p1;p1->former=NULL;}
		 else {p2->next=p1;p1->former=p2;}
		  p2=p1; p1=(struct stu*)malloc(LEN);
		 scanf("%s",&p1->id);
		  if(strcmp(p1->id,"end")==0)break;
			// printf("%s",p1->id);
		  scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	}
		 

		  p2->next=NULL;
		  end=p2;
		  return (end);
	
 }
 else return(NULL);
}

void print(struct stu *end)
{
	

	struct stu *q=end;  // printf("%s",end->id);

	while(q!=NULL&&end!=NULL)
	{
		printf("%s %s %c %d %s %s\n",q->id,q->name,q->sex,q->age,q->score,q->address);
		q=q->former;//printf("%s",q->id);
	}
//printf("%s",q->id);
}

int main()
{struct stu *p;
  p=cr();

print(p);
return 0;
}
struct student
{
 char num[100];
 char name[100];
 char sex[2];
 int age;
 char score[20];
 char addr[100];
 struct student *next;
};

struct student *creat(void)
{
 struct student *head;
 struct student *p1,*p2=NULL;
 p1=(struct student*)malloc(LEN);
 scanf("%s",p1->num);
 if (strcmp(p1->num,"end")!=0)
 {
 scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
 p1->next=NULL;
 p2=p1;
 
 while (1)
 { 
  p1=(struct student*)malloc(LEN);
  scanf("%s",p1->num);
  if (strcmp(p1->num,"end")==0)
   break;
  else
  {
   scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
   p1->next=p2;
   p2=p1;
  }  
 }
 }
 head=p2;
 return(head);
}
 
void print(struct student *head)
{
 struct student *p1;
 p1=head;
 while(p1!=NULL)
 {
  printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
  p1=p1->next;
 }
}
 
void main()
{
 struct student *head=NULL;
 head=creat();
 print(head);
}
struct Student
{
	char id[10];
	char name[100];
	char sex;
	char year[10];
	char mark[10];
	char ad[20];
}stu[1000];
int main()
{
	int i,k=0;
	for(i=0;;i++)
	{
		scanf("%s ",stu[i].id);
		if(stu[i].id[0]=='e')
			{break;}
		else
		{scanf("%s %c %s %s %s\n",stu[i].name,&stu[i].sex,stu[i].year,stu[i].mark,stu[i].ad);
		k++;}
	}
	for(i=k-1;i>=0;i--)
		printf("%s %s %c %s %s %s\n",stu[i].id,stu[i].name,stu[i].sex,stu[i].year,stu[i].mark,stu[i].ad);		
}
struct Student
{
char id[9];
char name[20];
char gen;
int age;
char grade[10];
char add[20];
struct Student *next;
};
void main()
{
struct Student *head,*p2,*p1,*newstu,*newhead;
int i,n=1;
char e[]={"end"};
p1=p2=head=(struct Student*)malloc(sizeof(struct Student));
scanf("%s %s %c %d %s %s",
	  &p1->id,&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
while(1)
{
p1=(struct Student*)malloc(sizeof(struct Student));
scanf("%s",&p1->id);
if(strcmp(p1->id,e)==0) {p2->next=NULL;break;}
else 
{
scanf(" %s %c %d %s %s",
	  &p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
p2->next=p1;
p2=p1;
n++;
}
}
for(i=0;i<n;i++)
{
 p2=p1=head;
 while(p1->next!=NULL)
 {
 p2=p1;
 p1=p1->next;
 }
 if(i==0)
	 newhead=newstu=p1;
 else
	 newstu=newstu->next=p1;
 p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->gen,p1->age,p1->grade,p1->add);
    p1=p1->next;
}
}
struct w
{char id[100];
struct w *next;
};
struct w *head,*new,*newhead,*p1,*p2;
 int i,n;
struct w *create(void)
{
    n=0;
	head=null;
	p1=p2=(struct w *)malloc(len);
	gets(p1->id);
	while(strcmp(p1->id,"end")!=0)
	{
	n++;
	if(n==1)head=p1;
	else p2->next=p1;
	p2=p1;
	p1=(struct w *)malloc(len);
	gets(p1->id);
	}
	p2->next=null;
	return head;
}
void main()
{
	head=create();
	for(i=0;i<n;i++)
	{p2=p1=head;
	while(p1->next!=null)
	{p2=p1;p1=p1->next;}
	if(i==0) newhead=new=p1;
	else new=new->next=p1;
	p2->next=null;
	}
	p1=newhead;
	for(i=0;i<n;i++)
	{printf("%s\n",p1->id);
	p1=p1->next;
	}
}
void main()
{
    char stu[10000][100],tem[100]={'e','n','d'};
    int i,j;
	for (i=0;i<10000;i++)
	{
		gets(stu[i]);
	
		if (strcmp(stu[i],tem)==0)break;
	}
	for(j=i-1;j>=0;--j)
	printf("%s\n",stu[j]);
}
int i=0;

struct shuju
{
    char xh[20];
    char xm[20];
    char sex;
    int age;
    char fen[10];
    char dorm[20];
    struct shuju * next;
};

struct shuju *create()
{
    
    struct shuju *head,*p1,*p2;
    p1=(struct shuju* )malloc(len);
    scanf("%s %s %c %d %s %s",p1->xh,p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
    head=p1;
    while (1)
    { 
    	i++;
    	p2=p1;
        p1=(struct shuju* )malloc(len); 
        scanf("%s",p1->xh);
        if (strcmp(p1->xh,"end")==0) {free(p1);break;}
        else
        {scanf("%s %c %d %s %s",p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
        p2->next=p1;}
    }
    p2->next=NULL;
    return (head);
}

/*struct shuju*create()
{
    struct shuju *head,*p1,*p2;
    p1=(struct shuju *)malloc(len);
    scanf("%s",p1->xh);
    if (strcmp(p1->xh,"end")!=0){
    scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
    p1->next=NULL;
    head=p1;
    p2=p1;
    do
    {
    	i++;
    	p1=(struct shuju* )malloc(len);
    	scanf("%s",p1->xh);
    	if (strcmp(p1->xh,"end")==0)
    	{
    	    free(p1);break;
    	}
    	else
    	{
    		scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
    		p1->next=NULL;
    		p2->next=p1;
    		p2=p1;
    	}
    }
    while(1);}
    else{head=NULL;}
    return(head);
}*/

void print(struct shuju* head)
{
    int j;
    struct shuju* p,*pre;
    
    for (j=0;j<i;j++)
    {
    	p=head;
    pre=p;
    	while (p->next!=NULL)
    {
        pre=p;
        p=p->next;
    }
    printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
   
    pre->next=NULL;}
}

void main()
{
    
    
    struct shuju *p;
    p=create();
    
    print(p);
}