unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
Function Sr(S1:string):string;
var n:integer; S2,k:string;
begin
  while length(S1)>0 do
    begin
      n:=Pos(' ',S1);
      S2:=Copy(S1,1,n-1);
      k:=copy(S2,length(S2),1);
      k:=StrToInt(k): integer;
        if k in [0,2,4,6,8] then Result:=S2;
      delete(S1,1,n);
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then Edit2.Text:=Sr(Edit1.Text);
end;

end.
