1. Расшифруй предложение, зашифрованное с чисел:11 31 62 32 17 62 35,17 62 35 27 63 32 44 63.
252
311
Ответы на вопрос:
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.
Популярно: Информатика
-
dim4ik1018.04.2022 03:52
-
vadim8963028511.06.2021 10:22
-
studpetrp011ry04.05.2023 10:35
-
Dolboeb900024.02.2023 21:45
-
harlamovegor20ow49y316.01.2022 13:47
-
ivanruzanov55306.06.2023 14:37
-
1Nicol106.08.2020 12:16
-
Nosochekxnncnnc27.06.2021 17:27
-
murad209703.03.2021 05:55
-
SkyForce14411.06.2020 01:02