Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/old/old/
Upload File :
Current File : /var/www/html/venkat/old/old/iim2015002_4.c

#include<stdio.h>
#include<stdlib.h>
struct ll
{
	int a;
	struct ll * next;
};
void main()
{
	int n,x,i=0;
	struct ll *t,*head,*tail;
	scanf("%d",&n);
	x=n;
	while(x--)
	{
		t=(struct ll*)malloc(sizeof(struct ll));
		scanf("%d",&(t->a));
		if(i==0)
		{
			head=t;
			tail=t;
		}
		else
		{
			tail->next=t;
			tail=t;
		}
		i++;
	}
	i=0;
	struct ll *ptr=head;
	do
	{
		
		printf("%d",ptr->a);
		if(i!=n-1)
		printf("-");
		ptr=ptr->next;
		i++;
	}
	while(ptr!=tail->next);
	i=0;
	ptr=head;
	printf("\n");
	do

	{
		
		if((ptr->a)%2==0)
		{
			if(i==0)
			printf("%d",ptr->a);
			else
			printf("-%d",ptr->a);
			i++;
		}
		ptr=ptr->next;
	}
	while(ptr!=tail->next);
	
}