var
a: string;
b: array[1..9]of integer;
sort: boolean;
max, k: integer;
begin
Readln(a);
for var i := 1 to Length(a) do
b[i] := strtoint(a[i]);
sort := false;
while sort = false do
sort := true;
k += 1;
for var i := 1 to Length(a)-1 do
if a[i] < a[i+1] then
var value2 := a[i];
a[i] := a[i+1];
a[i+1] := value2;
end;
write(a[1]);
end.
Программа написана на PascalABC.net
на free pascal или turbo pascal она может не работать
var
a: string;
b: array[1..9]of integer;
sort: boolean;
max, k: integer;
begin
Readln(a);
for var i := 1 to Length(a) do
b[i] := strtoint(a[i]);
sort := false;
while sort = false do
begin
sort := true;
k += 1;
for var i := 1 to Length(a)-1 do
begin
if a[i] < a[i+1] then
begin
sort := false;
var value2 := a[i];
a[i] := a[i+1];
a[i+1] := value2;
end;
end;
end;
write(a[1]);
end.
Программа написана на PascalABC.net
на free pascal или turbo pascal она может не работать