var
Total :
string
;
ss:
string
;
a:
array
of
shortstring
;
a2:
array
of
shortstring
;
procedure
TForm1
.
Button2Click(Sender: TObject);
var
i:
integer
;
begin
total:=
''
;
ss:=
'aaaabbcddb'
;
edit2
.
Text :=ss;
for
i:=low(ansArr)
to
qCount-
1
do
begin
total:= total + ansArr[i];
end
;
edit1
.
Text :=total;
Repeat
setlength(a,length(a)+
1
);
if
pos(
' '
,ss)>
0
then
begin
a[length(a)-
1
]:=copy(ss,
1
, pos(
' '
,ss));
ss:=copy(ss,pos(
' '
,ss)+
1
, length(ss));
end
else
begin
a[length(a)-
1
]:=ss;
break;
end
;
Until
False
;
Repeat
setlength(a2,length(a2)+
1
);
if
pos(
' '
,total)>
0
then
begin
a2[length(a2)-
1
]:=copy(total,
1
, pos(
' '
,total));
total:=copy(total,pos(
' '
,total)+
1
, length(total));
end
else
begin
a2[length(a2)-
1
]:=total;
break;
end
;
Until
False
;
end
;
procedure
TForm1
.
Button1Click(Sender: TObject);
var
z,i,j:
integer
;
r:
string
;
begin
z:=
0
;
for
i:=low(a)
to
high(a)
do
begin
if
a2[i]=a[i]
then
z:=z+
1
;
end
;
edit3
.
Text :=inttostr(z);
end
;