var s : array [1..5] of string; i, j : integer; buf : string; function less(var s1, s2 : string) : boolean; var i, n, which : integer; begin if length(s1) < length(s2) then n := length(s1) else n := length(s2); which := 0; i := 4; while (which = 0) and (i <= n) do begin if s1[i] < s2[i] then which := 1 else if s1[i] > s2[i] then which := 2; i := i + 1; end; if (which = 0) then less := length(s1) < length(s2) else if (which = 1) then less := true else less := false; end; begin writeln('Введите пять строк:'); for i := 1 to 5 do readln(s[i]); for i := 1 to 4 do begin for j := 5 downto i + 1 do begin if less(s[j], s[j - 1]) then begin buf := s[j]; s[j] := s[j - 1]; s[j - 1] := buf; end; end; end; for i := 1 to 5 do writeln(copy(s[i], 4, length(s[i]) - 3)); end.