semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct Student
	{
		char ID[10];
		char name[20];
		char sex;
		int age;
		float score[20];
		char add[20];
		struct Student*next;
	};
	int main()
	{
		struct Student a[1000],*head,*p;
	int i,j;
	for(i=0;;i++)
	{
		scanf("%s %s %c %d %s %s",a[i].ID,a[i].name,&a[i].sex,&a[i].age,a[i].score,a[i].add);
         if(a[i].ID[2]=='d')
		 {
			 printf("\n");
			 break;
		 }
	}
	for(j=i-1;j>=0;j--)
	{
		head=&a[i-1];
		a[j].next=&a[j-1];
		a[0].next=NULL;
		p=head;
	}
	do
	{
		printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
	}while(p!=NULL);
	return 0;
	}
int main()
{
	int i,n;
	char a[MAX][MAX];
	for(i=0; ;i++)
	{
		gets(a[i]);
		if(strcmp(a[i],"end")==0) break;
	}
    for(n=i-1;n>=0;n--)
	{
		puts(a[n]);
	}
	return 0;
}
struct Student
{
	struct Student *prev;
	char number[30];
	char name[30];
	char gender;
	int age;
	double score;
	char address[30];
};

int main()
{
	struct Student a,*p;
	scanf("%s%s %c%d%lf%s",a.number,a.name,&a.gender,&a.age,&a.score,a.address);
	p=(struct Student *)malloc(LEN);
	*p=a;
	(*p).prev=NULL;
	for(;1;)
	{
		scanf("%s",a.number);
		if(a.number[0]=='e')
			break;
		scanf("%s %c%d%lf%s",a.name,&a.gender,&a.age,&a.score,a.address);
		a.prev=p;
		p=(struct Student *)malloc(LEN);
		*p=a;
	}
	printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
	for(;(*p).prev!=NULL;)
	{
		p=p->prev;
		printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
	}
	return 0;
}
struct student
{
	char num[10];
	char name[20];
	char gender[2];
	int year;
	char score[10];
	char ad[20];
	struct student *next;
};

int main()
{
	int i,count=0;
	struct student *head,*p1,*p2,*p,*q,*temp;
	for(i=1;i<=10000;i++){
		p1=(struct student *)malloc(sizeof(struct student));
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0){
			head=temp;
			break;
		}
		else if(i==1){
			p1->next=NULL;
			p2=p1;
			temp=p1;
		}
		else{
			p1->next=p2;
			p2=p1;
			temp=p1;
		}
		scanf("%s",p1->name);
		scanf("%s",p1->gender);
		scanf("%d",&p1->year);
		scanf("%s",p1->score);
		scanf("%s",p1->ad);
		count=count+1;
	}
	for(i=1;i<=count;i++){
		if(i==1){
			p=head;
		}
		printf("%s %s %s %d %s %s\n",p->num,p->name,p->gender,p->year,p->score,p->ad);
		p=p->next;
		if(p==NULL){
			break;
		}
	}


	return 0;
}
struct stu
{
	char num[15];
	char name[20];
	char gender;
	int age;
	char score[10];
	char add[20];
	struct stu *next;
};
int n;
struct stu *creat(void)
{
	struct stu *head,*p,*q;
	p=q=(struct stu*)malloc(LEN);
	scanf ("%s%s %c %d %s%s",(*p).num,(*p).name,&(*p).gender,&(*p).age,(*p).score,(*p).add);
	for (n=0;(*p).gender=='f'||(*p).gender=='m';n++)
	{
         if (n==0) (*p).next=NULL;
		 else (*p).next=q;
		 q=p;
		 p=(struct stu*)malloc(LEN);
		 scanf("%s%s %c %d %s%s",(*p).num,(*p).name,&(*p).gender,&(*p).age,(*p).score,(*p).add);
	}
	head=q;
	return(head);
}
void print(struct stu *head)
{
	struct stu *p;
	if (head!=NULL)
		for (p=head;p!=NULL;p=(*p).next)
			printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).gender,(*p).age,(*p).score,(*p).add);
}
void main()
{
	struct stu *head;
	head=creat();
	print(head);
}
/*
 * justexp.cpp
 *
 *  Created on: 2011-11-18
 *      Author: dell
 */
int main()
{
	struct data
	{
		char num[200];
		char name[200];
		char gender;
		int age;
		float score;
		char add[200];
	}student[2000];
	int count=0;
	while(true)
	{
		memset(student[count].num,'\0',sizeof(student[count].num));
		cin>>student[count].num;
		if(strcmp(student[count].num,"end")==0)
			break;
		cin>>student[count].name>>student[count].gender>>student[count].age>>student[count].score>>student[count].add;
		count++;
	}
	while(count--)
	{
		cout<<student[count].num<<" "<<student[count].name<<" "<<student[count].gender<<" "<<student[count].age<<" "<<student[count].score<<" "<<student[count].add<<endl;
	}
	return 0;
}
struct Student
{
	char inf[81];
	struct Student *front,*next;
};

int n;
struct Student *creat()
{
	struct Student *head,*p1,*p2,*temp;
	n=0;
	p1=p2=(struct Student *)malloc(LEN);
	gets(p1->inf);
	head=NULL;
	while(strcmp(p1->inf,"end")!=0)
	{
		n++;
		if(n==1)
		{
			head=p1;p1->front=NULL;
		}
		else
		{
			p2->next=p1;
			p1->front=temp;
		}
		p2=p1;
		temp=p1;
		p1=(struct Student *)malloc(LEN);
		gets(p1->inf);
	}
	p2->next=NULL;
	return(p2);
}

int main()
{
	struct Student *pt;
	pt=creat();
	if(pt!=NULL)
	{
		do
		{
			puts(pt->inf);
			pt=pt->front;
		}
		while(pt!=NULL);
	}
	return 0;
}
struct student
	{
		char number[10];
		char name[100];
		char sex;
		int age;
		char score[20];
		char add[20];
		struct student *pre;
	};
int n;

	struct student *creat(void)
	{
		struct student *tail;
		struct student *p1,*p2;
		n=0;
		p1=p2=(struct student *)malloc(sizeof(struct student));
		scanf("%s %s %c %d %s %s",p1->number,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		p1->pre=NULL;
		while(1)
		{
			n++;
			tail=p1;
			p1=(struct student *)malloc(sizeof(struct student));
			scanf("%s",p1->number);
			if(strcmp(p1->number,"end")==0)
				break;
			scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
			p1->pre=p2;
			p2=p1;
		}
		return(tail);
	}

    void print(struct student *tail)
	{
		struct student *p;
		p=tail;
			do
			{
			  printf("%s %s %c %d %s %s\n",p->number,p->name,p->sex,p->age,p->score,p->add);
			  p=p->pre;
			}while(p!=NULL);
	}

	void main()
	{
		print(creat());
	}
struct student
{
   struct student *last;
   char a[100];
};

int main ()
{
  // freopen ( "1.in" , "r" , stdin );
  // freopen ( "1.out" , "w" , stdout );
   
   char a[100];
   struct student *p , *p1;
   p = p1 = ( struct student * ) malloc ( sizeof ( struct student ) );
   p1->last = NULL;
   gets ( p1->a );
   for ( ; ; )
    {
     gets ( a );
     if ( strcmp ( a , "end" ) == 0 ) break;
     p = ( struct student * ) malloc ( sizeof ( struct student ) );
     strcpy ( p->a , a );
     p->last = p1;
     p1 = p;
    }
   for ( ; ; )
    {
     printf ( "%s" , p->a );
     p = p->last;
     if ( p == NULL ) break;
      else printf ( "\n" );
    }
   return 0;
}
struct stu
{
	char info[1000];
	struct stu * next;
};
struct stu * head;
struct stu * create()
{
	
	char str1[]="end";
	struct stu *p1,*p2,*p;
	p1=(struct stu*)malloc(Len);
	gets(p1->info);
	p1->next=NULL;
	if(strcmp(p1->info,str1)==0)
	{
		free(p1);
		head=NULL;
		return head;
	}
	else
	{
		head=p1;
		p2=p1;
		do{
			p1=(struct stu*)malloc(Len);
	        gets(p1->info);
	        p=head;
			
			if(strcmp(p1->info,str1)==0)
			{
				free(p1);
				break;
			}
			else
			{
				
				p1->next=p2;
				head=p1;
				p2=p1;
				
			}
		}while(1);
			return head;
	}
}
	
void print(struct stu * head)
{
	struct stu * p;
	p=head;
	if(head!=NULL)
		do
		{
			puts(p->info);
			
			p=p->next;
		}while(p!=NULL);
}
void main()
{

	create();

	print(head);
}
struct stu
{
	char xuehao[20];
	char name[20];
	char sex[10];
	int old;
	float score;
	char where[20];
	struct stu *next;
};
void main()
{
	struct stu *head,*p0,*p;
	int i;
	char a[4]="end\0";
	head=NULL;
	for(i=0;;i++)
	{
		p0=(struct stu*)malloc(LEN);
		scanf("%s",p0->xuehao);
		if(strcmp(p0->xuehao,a)==0)
			break;
		scanf("%s%s%d%f%s",p0->name,p0->sex,&p0->old,&p0->score,p0->where);
		if(head==NULL)
		{
			head=p0;
			p0->next=NULL;
			p=p0;
		}
		else
		{
			head=p0;
			p0->next=p;
			p=p0;
		}
	}
	for(p=head;p!=NULL;p=p->next)
	{
		printf("%s %s %s %d %g %s\n",p->xuehao,p->name,p->sex,p->old,p->score,p->where);
	}
}
//#include <memory.h>
struct information
{char info[50];
 struct information*next;
};

struct information* creat()
{struct information *head,*p1,*p2;
 p1=p2=(struct information*)malloc(len);
 p1->next=NULL;
 gets(p1->info);
 while(strcmp(p1->info,"end")!=0)
	{p2=p1;
	 p1=(struct information*)malloc(len);
     gets(p1->info);
	 p1->next=p2;
	 }
 return p2;
} 

void print(struct information*head)
{
 while(head!=NULL)
	{printf("%s\n",head->info);
     head=head->next;
	}
}

main()
{struct information*head;
 head=creat();
 print(head);
}
void main()
{
	int i,j,k,m,n;
	struct stu
	{
		char xh[100];
		char xm[100];
		char xb;
		int nl;
		float df;
		char dz[100];
		struct stu *af;
		struct stu *bf;
	};
	struct stu *p1,*p2,*head;
	head=p2=p1=(struct stu *)malloc(sizeof(struct stu));
	scanf("%s %s %c %d %f %s",p1->xh,p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
	p1->bf=0;
	for(i=1;;i++)
	{
		p1=(struct stu *)malloc(sizeof(struct stu));
		scanf("%s",p1->xh);
		if(strcmp(p1->xh,"end")==0)
		{
			head=p2;
			break;
		}
		scanf("%s %c %d %f %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
		p2->af=p1;
		p1->bf=p2;
		p2=p1;
	}
	p1=head;
	for(j=0;j<i;j++)
	{
		printf("%s %s %c %d %g %s\n",p1->xh,p1->xm,p1->xb,p1->nl,p1->df,p1->dz);
		p1=p1->bf;
	}
}
void main()
{
	struct student
	{
		char info[1000];
		struct student *pre,*next;
	} *head,*tail,*p;
	int l;
	l=sizeof(struct student);
	head=(struct student*)malloc(l);
	p=head;
	p->pre=NULL;
	p->next=NULL;
	for (;;)
	{
		gets(p->info);
		if (strcmp(p->info,"end")==0) {tail=p;break;}
		p->next=(struct student*)malloc(l);
		(p->next)->pre=p;
		(p->next)->next=NULL;
		p=p->next;
	}
	p=tail;
	for (;;)
	{
		if (!(p->pre)) {free(p);break;}
		puts((p->pre)->info);
		p=p->pre;
		free(p->next);
	}
}
struct student
{
	char number[40];
	char name[50];
	char sex;
	int age;
	float score;
	char address[50];
	struct student *next;
};
int n;
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(Len);
	head=NULL;
	scanf("%s%s %c%d%f%s",p1->number,p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address);
	n=0;
	while(1){
		n++;
		if(n==1){
			head=p1;
		}else{
			p2->next=p1;
		}
		p2=p1;
		p1=(struct student*)malloc(Len);
		scanf("%s",p1->number);
		if(*p1->number=='e'){
			break;
		}
		scanf("%s %c%d%f%s",p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address);
	}
	p2->next=NULL;
	return(head);
}
struct student *reverse(struct student *head)
{
	struct student *p1,*p2,*p3;
	p1=head;
	p2=p1;
	p3=p1;
	do
	{
		if(p3==head){
			p3=p2->next;
			p2=p3;
			p1->next=NULL;
		}else{
			p3=p2->next;
			p2->next=p1;
			p1=p2;
			p2=p3;
		}
	}while(p3!=NULL);
	head=p1;
	return (head);
}
int main()
{
	struct student *head;
	head=creat();
	head=reverse(head);
	struct student *p1;
	p1=head;
	while(p1!=NULL){
		printf("%s %s %c %d %g %s\n",p1->number,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p1=p1->next;
	}
	return 0;
}
//#include<stdlib.h>//
struct student
{
        struct student *bef;
        char n[10];
        char s[20];
        char sex;
        int age;
        char score[10];
        char address[20];
        struct student *next;
};
int n;
struct student *creat(void)
{
       
        struct student *p1,*p2;
        n=0;
        p1=p2=(struct student*)malloc(LEN);
        
                scanf("%s %s %c %d %s %s",(p1->n),(p1->s),&(p1->sex),&(p1->age),p1->score,p1->address);
                
                while(p1->n[0]!='e')
                {
                        n=n+1;
                        if(n==1)
                        {
                             
                             p1->bef=NULL;
                        }
                        else 
                        {
                                p2->next=p1;
                                p1->bef=p2;
                        }
                        p2=p1;
                        p1=(struct student*)malloc(LEN);
						
                        scanf("%s %s %c %d %s %s",p1->n,p1->s,&(p1->sex),&(p1->age),p1->score,p1->address);
			            
                }
                p2->next=NULL;
                
		
		return(p2);
}


        int main()
        {
                struct student *p;
                p=creat();
                do
                {
                        printf("%s %s %c %d %s %s\n",p->n,p->s,p->sex,p->age,p->score,p->address);
                        p=p->bef;
                }while(p!=NULL);
        return 0;
        }
typedef struct linknode
 {
       char inf[500];
	   struct linknode *next,*prev;
 } snode,*ptr;

 main ()
 {
     int i,a1,a2,j,min,k; 
	 ptr head,p1,p2,p3;
	  
	 k=0;
     for (i=1;i<=5;i)
	 {
         p1=(ptr)malloc(sizeof(snode));
		 if (k==0) {head=p1; p2=p1;}
		 else {(*p2).next =p1; (*p1).prev=p2;}
         
	     gets((*p1).inf);
		 if ((*p1).inf[0]!='e') 
		 {
			 p2=p1; k++;
		 }
		 else
		 {
		     p1=p2; i=6; 
		 }
	 }

	 

	 for (i=1;i<=k;i++)
	 {
	     printf ("%s\n",(*p1).inf  );
		 if (i!=k) p1=(*p1).prev ;

	 }
	 
 }
struct list{
	char no[10];
	char name[20];
	char gene;
	unsigned int age;
	float score;
	char add[20];
	struct list *next;
};

struct list *creat()
{
	struct list *p1=NULL,*p2=NULL,*head;
	int n=0;
	do{
        p2=p1;
		p1=(struct list*)malloc(sizeof(struct list));
	    scanf("%s",p1->no);
		if(*p1->no=='e')    
		{
			head=p2;
			free(p1);
			break;
		}	
		scanf("%s %c %d %f %s\n",p1->name,&p1->gene,&p1->age,&p1->score,p1->add);
		if(n==0)p1->next=NULL;
		if(n!=0)p1->next=p2;
		n=1;
	}while(1);
	return head;
}

int main()
{
	struct list *p;
	p=creat();
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->no,p->name,p->gene,p->age,p->score,p->add);
		p=p->next;
	}
	return 0;
}
void main()
{
    struct fy
	{
		char xh[100];
		char xm[100];
		char xb;
		int nl;
		float df;
		char dz[100];
		struct fy *pre;
	};
	struct fy *p,*node;
	int n=1;
	for(;;)
	{
	node= (struct fy *)malloc(sizeof(struct fy));
	if(n==1) node->pre=NULL;
	else node->pre=p;
	scanf("%s",node->xh);
	if(strcmp(node->xh,"end")==0) break;
	scanf("%s %c %d %f %s",node->xm,&node->xb,&node->nl,&node->df,node->dz);
	p=node;
	n++;
	}
	for(;node->pre!=NULL;)
	{
		node=node->pre;
		printf("%s %s %c %d %g %s\n",node->xh,node->xm,node->xb,node->nl,node->df,node->dz);
	}

   
}
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	float score;
	char address[20];
	struct student *next;
};
int n;
struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	int num=0;
	head=NULL;
	while (1)
	{
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if (strcmp(p1->num,"end")==0)
		{
			p2->next=NULL;
			break;
		}
		else
		{
			scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
			if (num==0)
				head=p1;
			else
				p2->next=p1;
			p2=p1;
			num++;
		}
	}
	n=num;
	return (head);
}
void print (struct student *pt)
{
	struct student *p,*pre;
	int i;
	for (i=1;i<=n;i++)
	{
		for (p=pre=pt;p->next!=NULL;p=p->next)
			pre=p;
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		if (p!=pt)
		{
			pre->next=NULL;
			free(p);
		}
	}
}
int main()
{
	struct student *pt;
	pt=creat();
	print(pt);
	return 0;
}
struct student
{
	char num[15];
	char name[30];
	char sex[2];
	short age;
	float score;
	char address[30];
	struct student *former;
};
void main()
{
    struct student *p1,*p2;
    p1=p2=(struct student *)malloc(LEN);
    scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->address);
    p1->former=NULL;
    while(1)
    {
    	p1=(struct student *)malloc(LEN);
    	scanf("%s",p1->num);
    	if (strcmp(p1->num,"end")==0) break;
    	scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address);
    	p1->former=p2;
    	p2=p1;
    }
    while (p2!=NULL)
    {
    	printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address);
    	p2=p2->former;
    }
}
typedef struct Node{
	char content[150];//??????????????????????????????)
	struct Node *next;//??????
	struct Node *front;
}node,*ptr;
main()
{
	char temp[150],std[4] = "end";//std???????
	ptr head = NULL,p,q;//head???
	while(1){
		gets(temp);
		if(strcmp(temp,std) != 0){
			p = (ptr)malloc(sizeof(node));
			strcpy(p->content,temp);
			p->next = NULL;
			p->front = NULL;
			if(head == NULL)
				head = p;
			else{
				q->next = p;
				p->front = q;
			}
			q = p;
		}
		else 
			break;
	}
	while(p != NULL){
		printf("%s\n",p->content);
		p = p->front;
	}
}
int main()
{
	int m,n,i,s;
	char a[1000][100];
	for(i=1;;i++)
	{
		gets(a[i]);
		if(strcmp(a[i],"end")==0)
			break;
	}
	for(s=i-1;s>0;s--)
		printf("%s\n",a[s]);
	return 0;
}
main()
{
      char a[3000][50],end[5]="end";int i=-1;
      do
      {
           i++;
           gets(a[i]);
      }
      while(a[i][0]!='e');
      i--;
      while(i>=0)
      {
      puts(a[i]);
      i--;
      }
}
struct Student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct Student *next;
};
int n;
struct Student *creat()
{
	struct Student *head,*p1,*p2;
	p1=p2=(struct Student *) malloc(LEN);				
	scanf("%s",p1->num);
	while(p1->num[0]!='e')
	{
		n++;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
		if(n==1) p1->next=NULL;
		else
		{
			p1->next=p2;
			p2=p1;
		}
		p1=(struct Student *) malloc(LEN);
		scanf("%s",p1->num);
	}
	head=p2;
	return head;
}
void print(struct Student *head)
{
	struct Student *p;
	p=head;
	if(head!=NULL)
		do
		{
			printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
			p=p->next;
		}while(p!=NULL);
}
void main()
{
	struct Student *head;
	head=creat();
	print(head);
}
struct student
{
	char xuehao[10];
	char xingming[20];
	char xingbie;
	int nianling;
	float chengji;
	char dizhi[20];
	struct student *next;
};
struct student *creat()
{
	int n=0;
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(LEN);
	while(1)
	{
		scanf("%s",p1->xuehao);
		if(p1->xuehao[0]=='e') 
		{head=p2;
		break;}
		scanf("%s %c %d %f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->chengji,p1->dizhi);
		if(n==0) p1->next=NULL;
		else p1->next=p2;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		n++;
	}
	return head;
}
int main()
{
	struct student *p;
	p=creat();
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->chengji,p->dizhi);
		p=p->next;
	}
	return 0;
}
int n;
struct student
{
	char str[100];
	struct student *pre;
} *p1, *p2;

struct student *create(void)
{   
	struct student *last, *head;	
	p1 = p2 = (struct student *)malloc(sizeof(struct student)); //????
	gets(p1->str);//?????
	head=NULL;
	n=0;	
	while (strcmp(p1->str,"end")!=0)
	{	
		    n=n+1;	//??????	
		if (n==1)		
		{   
			head=p1;
			p1->pre = NULL;//??????pre??			
		}		
		else		
		{
			p1->pre = p2;//????pre????????
			
		}
		    p2 = p1;//?????
		    p1 = (struct student *)malloc(sizeof(struct student));//????
			gets(p1->str);	
			
	}
	last=p1->pre=p2;	    
	return (last);
}
void main ()
{    
	 struct student *create();
	 struct student *last, *p;	 
	 last=create();
	 p=last;
	 if(p==last)
		 printf("%s\n", p->str);
	for( p=last;p=p->pre;printf("%s\n", p->str));
            
    
}
//#define NULL 0
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[10];
	char adress[20];
//	struct student *next;
	struct student *before;
};

struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int n;
	n=0;
	p1=p2=(struct student *)malloc(LEN);
//	scanf("%s %s %c %d %d %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->adress);
    scanf("%s",p1->num);
	head=NULL;
    while(strcmp(p1->num,"end")!=0)
	{
        scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adress);
		n++;
		if(n==1)
		{
//			head=p1;
			p1->before=NULL;
		}
		else
		{
			p1->before=p2;
			head=p1;
		}
		p2=p1;
		p1=(struct student *)malloc(LEN);
        scanf("%s",p1->num);
/*		if(strcmp(p1->num,"end")==0)
			break;
		else
			scanf(" %s %c %d %d %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->adress);*/
	}
//	head=p2;
	return(head);
}


void main()
{
	struct student *head,*q1;
	head=creat();
	q1=head;
	if(head!=NULL)
	{	
		while(q1!=NULL)
		{
	    printf("%s %s %c %d %s %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress);
	    q1=q1->before;
		}
   //     printf("%s %s %c %d %d %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress);
	}
	
}
int i,n,m,t;
struct stu
{ 
	char num[1000];
	struct stu *next;
};

struct stu *creat(void)
{
	struct stu *head;
	struct stu *p1,*p2;
	n=0;
	p1=p2=(struct stu *)malloc(len);
	gets(p1->num);
	while(strcmp(p1->num,"end")!=0)
	{
		n=n+1;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct stu *)malloc(len);
		gets(p1->num);
	}
	p2->next=NULL;
	return (head);
}

void print(struct stu *head)
{
	struct stu *p1,*p2;
	m=n;
	t=n;
	for(i=1;n>0;i++)
	{
		while(n>0)
		{
			if(n==t) p2=p1=head;
			else p2=p1;
			p1=p1->next;
			n=n-1;			
		}
		printf("%s\n",p2->num);
		n=m-i;
		t=n;
	}
}

void main()
{
	struct stu *head;
	head=creat();
	print(head);
}
struct student
{
	char num[30];
	char name[30];
	char sex;
	int age;
	char score[20];
	char add[30];
	struct student *next;
};
int main()
{
	struct student *p,*p1;
	int n=0;
	p=(struct student *)malloc(LEN);
	scanf("%s %s %c %d %s %s",p->num,p->name,&p->sex,&p->age,p->score,p->add);
	//printf("%s %s %c %d %f %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
//printf("%c\n",p->num[0]);
	while(1)
	{
		n++;
		if(n==1) p->next=NULL;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		//printf("%s\n",p1->num);
		if(strcmp(p1->num,"end")==0) break;
		else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		//printf("%s %s %c %d %f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1->next=p;
		p=p1;
		//printf("%d\n",n);
	}
	//printf("%d\n",n);
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
	}
	return 0;
}
struct stu
	{char id[100];
	char name[100];
	char sex[3];
	char age[10];
	char score[10];
	char add[100];
	struct stu *next;
	};

int main()
{
	int k,m,n,t,ans,ii,i,j,jj,flag;
	struct stu *p0,*p1,*p2,*head;
	char s[30];
	p1 = (struct stu*)malloc(LEN);
	scanf("%s%s%s%s%s%s",p1->id,p1->name,p1->sex,&p1->age,&p1->score,p1->add);
	p1->next = NULL;
	head = p1;
	p2 = p1;
	while (1)
	{
		p1 = (struct stu*)malloc(LEN);
		scanf("%s",p1->id);
		if (strcmp(p1->id,"end")==0)
		{
			head = p2;	
			break;
		}
		scanf("%s%s%s%s%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
		p1->next = p2;
		p2 = p1;
	}

	p1 = head;
	while (p1->next!=NULL)
	{
		printf("%s %s %s %s %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1 = p1->next;
	}
	printf("%s %s %s %s %s %s",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add);
	return 0;
}
struct student
{
    char number[100];
    char name[100];
    char sex;
    int age;
    char score[100];
    char address[100];
    struct student *prev;
    struct student *next;
};
int main()
{
    struct student *phead,*p,*q;
    char m[10];
    phead=(struct student*)malloc(sizeof(struct student));
    phead->prev=NULL;
    scanf("%s",m);
    q=phead;
    do 
    {
        p=(struct student*)malloc(sizeof(struct student));
        strcpy(p->number, m);
        scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,&p->score,p->address);
        p->prev=q;
        q->next=p;
        q=q->next;
        scanf("%s",m);
    } while (strcmp(m,"end")!=0);
    q->next=NULL;
    p=phead;
    while (p->next!=NULL) p=p->next;
    while (p!=phead)
    {
        printf("%s %s %c %d %s %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
        p=p->prev;
    }
}
struct student
{
	char str[100];
	struct student *next;
};
int n;
char end[5]="end";

struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(LEN);
	gets(p1->str);
	head=null;
	while(strcmp(p1->str,end)!=0)
	{
		n=n+1;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		gets(p1->str);
	}
	p2->next=null;
	return(head);
}

void main()
{
	struct student *p1,*p2,*p3,*head;
	head=creat();
	p1=head;
	p2=p1->next;
	p3=p2->next;
	while(p3!=null)
	{
		p2->next=p1;
		p1=p2;
		p2=p3;
		p3=p2->next;
	}
	p2->next=p1;
	head->next=null;
	do
	{
		printf("%s\n",p2->str);
		p2=p2->next;
	}
	while(p2!=null);
}