program xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
uses crt;
type ref=^elem;
     elem=record
          inf:char;
          leg:ref;
     end;
var p,v:ref;
    n:integer;
procedure creere;
begin
  new(v);v:=nil;
  repeat
   new(p);p^.inf:=readkey;write(p^.inf);p^.leg:=v;v:=p;
  until p^.inf=#13;
end;
procedure afisare(v:ref);
begin
  p:=v;
  writeln;
  repeat
    write(p^.inf);p:=p^.leg;
  until p=nil;
end;
begin clrscr;creere;afisare(v);readkey;end.