Суть задачи такова: Дана строка, состоящая из групп нулей и единиц. Каждая группа отделяется от другой одним или несколькими пробелами.Подсчитать количество символов в самой длинной группе. Нашел вот такой исходник, пытался понять но так и не понял, объясните кто-нибудь код)

procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
i,l,c,m:integer;
z,u:boolean;
begin
if combobox1.Text<>'' then
begin
s:=combobox1.Text;
combobox1.Items.Insert(0,s);
l:=length(s);
z:=false;
u:=false;
c:=0;
m:=0;
for i:=1 to l do
begin
if ((s[i]='0')and not z)or((s[i]='1')and not u)then
begin
if m end;
if ((s[i]='0')and not z) then
begin
u:=false;
z:=true;
c:=0;
end;
if ((s[i]='1')and not u) then
begin
u:=true;
z:=false;
c:=0;
end;
if ((s[i]='0')and z)or((s[i]='1')and u)then
c:=c+1;
end;
if m label1.Caption:='Количество символов в самой длинной группе: '+inttostr(m);
end;
end;
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Copyright © 2024 SCHOLAR.TIPS - All rights reserved.