SHARE
TWEET

Untitled

a guest Dec 10th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program lab8;
  2. //uses crt;
  3. var
  4. s : string;
  5. a:array[1..1000] of char;
  6. i,m,j : integer;
  7. k:char;
  8. begin
  9. m:=0;
  10. readln(s);
  11. for i:=1 to length(s) do begin
  12. if (s[i] in ['0'..'9'])
  13. then
  14. a[i]:=s[i];
  15. m:=m+1;
  16. end;
  17.  writeln(m);
  18. for i := 1 to m do
  19.  write (a[i]:1);
  20. for i := 1 to m-1 do
  21.  for j := 1 to m-i do
  22.  if a[j] > a[j+1] then begin
  23.  k := a[j];
  24.  a[j] := a[j+1];
  25.  a[j+1] := k
  26.  end;
  27.  writeln ('Отсортированный массив: ');
  28.  for i := 1 to m do
  29.  write (a[i]:1);
  30. for i:=1 to length(s) do
  31. begin
  32. if (s[i] in ['0'..'9']) then
  33. s[i]:=a[i];
  34. end;
  35. WriteLn('Полученная строка: ', s);
  36. //Readln ;
  37. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top