#include<stdio.h>
#include<malloc.h>
#include<string.h>
typedef int ElemType;
typedef struct node{
ElemType data;
struct node *next;
}LinkList;
void CreateList(LinkList *&L,ElemType a[],int n){
LinkList *s;
int i;
L=(LinkList *)malloc(sizeof(LinkList));
L->next=NULL;
for(i=0; i<n; i++){
s=(LinkList *)malloc(sizeof(LinkList));
s->data=a[i];
s->next=L->next;
L->next=s;
}
}
int ListLength(LinkList *L){
LinkList *p=L;
int n=0;
while(p->next!=NULL){
n++;
p=p->next;
}
return(n);
}
void DispList(LinkList *L){
LinkList *p=L->next;
while(p!=NULL){
printf("%d",p->data);
p=p->next;
}
}
int a[100000];
int main(){
int x;
int cnt=-1;
while(scanf("%d",&x)!=EOF){
a[++cnt]=x;
}
LinkList *p;
CreateList(p,a,cnt+1);
printf("%d
",ListLength(p));
DispList(p);
// printf("
");
return 0;
}