delphi?该怎么处理

delphi???????!!!!!!!!!!!
edit1 edit2 edit3三个控件
要实现以下功能:
在EDIT1中输入 0 ,则EDIT2中显示输入的0的个数
如输入0 EDIT2显示1,再次输入0 EDIT2显示2


在EDIT1中输入 1 ,则EDIT3中显示输入的1的个数
如输入1 EDIT3显示1,再次输入1 EDIT3显示2


------解决方案--------------------
Delphi(Pascal) code
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var i,i_0,i_1:integer;
begin
  i_0:=0;
  i_1:=0;
  if key='0' then i_0:=1
  else if key='1' then i_1:=1;
  for i:=1 to length(edit1.Text) do begin
    if edit1.Text[i]='0' then inc(i_0)
    else if edit1.Text[i]='1' then inc(i_1);
  end;
  edit2.Text:=inttostr(i_0);
  edit3.Text:=inttostr(i_1);
end;

------解决方案--------------------
是,来晚了,接个分