Дана строка,выбрать из нее все цифры и упорядочить по возрастанию.(паскаль АВС)
Answers & Comments
emblerik
Var a : array ['0'..'9'] of integer; s : string; i : integer; j : char; begin readln (s); for i := 1 to length (s) do if s[i] in ['0'..'9'] then inc (a[s[i]]); for j := '0' to '9' do for i := 1 to a[j] do write (j); end.
Answers & Comments
a : array ['0'..'9'] of integer;
s : string;
i : integer;
j : char;
begin
readln (s);
for i := 1 to length (s) do
if s[i] in ['0'..'9'] then inc (a[s[i]]);
for j := '0' to '9' do
for i := 1 to a[j] do
write (j);
end.