unit Unit1;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

Function Krz(St: string): Word; //Подсчет количества различных символов
Var a:set of char;
    m, i: Word;
begin
 m:=0;
 a:=[];
 for i:=1 to Length(St) do
          if not(St[i] in a) then
          begin
           Include(a,St[i]);
           Inc(m);
          end;
Result:=m;
end;

Function FWord(St: String): String;
Var
 i,l,r: Integer;
 s,s2:string;
begin
 s2:='';
 s:='';
 l:=1;
 r:=1;
 for i:=1 to Length(st) do
   if (st[i]=' ')or(i=Length(st))  then
   begin
      r:=i;
      if (i=Length(st))and(st[i]<>' ') then r:=r+1;
      s2:=copy(st,l,r-l);
      if length(s2) mod 2 = 0 then
      s:=s+' '+s2;
      l:=i+1;
   end;
FWord:=s;
end;

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

procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Close();
end;

end.
