var ch,i,j:integer;
a: array[1..4] of integer;
begin
for ch:=1000 to 9999 do begin
for i:=1 to 4 do
for j:=2 to 4-i do
a[1]:= ch div 1000;
a[2]:= (ch div 100) mod 10;
a[3]:= (ch div 10) mod 100;
a[4]:= ch mod 10;
If a[i] = a[j] then begin
write(ch,' ');
end; end;
end.
var ch,i,j:integer;
a: array[1..4] of integer;
begin
for ch:=1000 to 9999 do begin
for i:=1 to 4 do
for j:=2 to 4-i do
a[1]:= ch div 1000;
a[2]:= (ch div 100) mod 10;
a[3]:= (ch div 10) mod 100;
a[4]:= ch mod 10;
If a[i] = a[j] then begin
write(ch,' ');
end; end;
end.