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 Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  type
   Ta = array [1..100]of string;
var
  Form1: TForm1;
  a:Ta;
  ot:word;
implementation

{$R *.dfm}
procedure delo(st:string);
var  min,i,ks,n : word;
      sl : string;
   begin
   st:=st+' '; 
      min:=10000; n:=length(st); sl:=''; ks:=0;
      for i:=1 to n do
        begin
          if st[i]<> ' ' then sl:=sl+st[i]
          else if sl<> '' then
            begin
              inc(ks);
              a[ks]:=sl;
              if length(a[ks])<min then
                begin
                  min:=length(a[ks]);
                  ot:=ks;
                end;
              sl:='';                   
            end;

        end;
   end;
function krs(st:string):word;
var b : set of char;
    n,i,m : word;
begin
  b:=[];  m:=0; n:=length(st);
  for i:=1 to n do
    if not (st[i] in b) then
      begin
        include(b,st[i]);
        inc(m);
      end;
      result:=m;
end;

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

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
  begin
  delo(edit1.Text);               
    edit2.Text:=inttostr(ot)+' '+a[ot]+'-'+' '+inttostr(krs(a[ot]));
  end;
end;

end.
