unit Unit1;

interface

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

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

var
  Form1: TForm1;
  n,i,k,y: integer;
  St:string;
implementation

{$R *.dfm}




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
st:=Edit1.Text;
n:=Length(st);
k:=0;
for i:=1 to n do begin
if st[i]<>' ' then begin k:=k+1;
if k>y then y:=k; end
 else  k:=0;
end;
Edit2.Text:= inttostr(y)  ;
end;
end;
end.
