Const Letters = ['a'..'z', 'A'..'Z']; LineEnds = [#13, #10, #0, '.']; MAX_LEN = 255; var txt: array [0..MAX_LEN] of char; bnd: array [0..MAX_LEN, 0..1] of integer; tsz, bsz: integer; // размеры массивов isLetter, isWord, f1, f2: boolean; i, j: integer; begin repeat read(txt[tsz]);
// Определение границ слов isLetter := txt[tsz] in Letters; if isLetter and not isWord then bnd[bsz, 0] := tsz; if isWord and not isLetter then begin bnd[bsz, 1] := tsz; bsz := bsz + 1; end;
isWord := isLetter; tsz := tsz + 1; until txt[tsz-1] in LineEnds;
if bsz > 1 then begin for i := 0 to bsz-2 do begin j := 0; f2 := true; f1 := (bnd[bsz-1, 1] - bnd[bsz-1, 0]) = (bnd[i, 1]-bnd[i, 0]); // совпадение длин
while (j < bnd[i, 1] - bnd[i, 0]) and f2 do begin f1 := f1 and (txt[bnd[i, 0] + j] = txt[bnd[bsz-1, 0] + j]); f2 := f2 and (LowCase(txt[bnd[i, 0] + j]) = Chr(Ord('a') + j)); j := j + 1; end;
// вывод if f2 and not f1 then begin for j := bnd[i, 0] to bnd[i, 1] - 1 do write(txt[j]); writeln; end; end; end; end.
Letters = ['a'..'z', 'A'..'Z'];
LineEnds = [#13, #10, #0, '.'];
MAX_LEN = 255;
var
txt: array [0..MAX_LEN] of char;
bnd: array [0..MAX_LEN, 0..1] of integer;
tsz, bsz: integer; // размеры массивов
isLetter, isWord, f1, f2: boolean;
i, j: integer;
begin
repeat
read(txt[tsz]);
// Определение границ слов
isLetter := txt[tsz] in Letters;
if isLetter and not isWord then
bnd[bsz, 0] := tsz;
if isWord and not isLetter then begin
bnd[bsz, 1] := tsz;
bsz := bsz + 1;
end;
isWord := isLetter;
tsz := tsz + 1;
until txt[tsz-1] in LineEnds;
if bsz > 1 then begin
for i := 0 to bsz-2 do begin
j := 0; f2 := true;
f1 := (bnd[bsz-1, 1] - bnd[bsz-1, 0]) = (bnd[i, 1]-bnd[i, 0]); // совпадение длин
while (j < bnd[i, 1] - bnd[i, 0]) and f2 do begin
f1 := f1 and (txt[bnd[i, 0] + j] = txt[bnd[bsz-1, 0] + j]);
f2 := f2 and (LowCase(txt[bnd[i, 0] + j]) = Chr(Ord('a') + j));
j := j + 1;
end;
// вывод
if f2 and not f1 then begin
for j := bnd[i, 0] to bnd[i, 1] - 1 do
write(txt[j]);
writeln;
end;
end;
end;
end.
var
a: array[1..20, 1..20] of integer;
n, m, i, j, jm: integer;
begin
randomize;
writeln('Введите количество строк и столбцов соответственно: ');
readln(n, m);
writeln('Сгенерированная матрица: ');
for i := 1 to n do
begin
jm := 1;
for j := 1 to m do
begin
a[i, j] := random(99);
write(a[i, j]:4);
if (i mod 2 = 0) and (a[i, jm] > a[i, j])
then jm := j;
end;
if i mod 2 = 0 then write(' min=a[', i, ',', jm, ']=', a[i, jm]);
writeln;
end;
readln;
end.