Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program dop;
- const
- lmax = 20;
- type
- massstr = array [1..lmax] of string;
- nomer = array [1..lmax] of integer;
- var
- mass1, mass2, checkmass: massstr;
- nom: nomer;
- k1, k2, i, num, kol: integer;
- check: string;
- procedure task1(var mass1: massstr; k1: integer);
- var
- flag: boolean;
- i, n, j, l, x, c, max, nom1, k, nom2: integer;
- chr: string;
- begin
- chr := 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
- for i := 1 to k1 do
- begin
- n := length(mass1[i]);
- nom1 := 0;
- max := 0;
- flag := false;
- l := 0;
- kol := 0;
- k2 := 0;
- begin
- if
- while (j<n) and (pos(mass1[i][j], chr) > 0) do
- begin
- inc(nom2);
- if nom1 = 0 then
- nom1 := j;
- inc(j);
- end;
- begin
- if nom2-nom1>= max then
- mass2[i]:=copy(mass1[i],nom1,nom2-nom1+1);
- writeln(mass2[j],' ', j, ' ');
- nom1:=0;
- nom2:=0;
- end;
- end;
- {if k2 = 0 then
- writeln('Нет изменений в строке ', i)
- else
- flag := true;
- for k := 1 to k2 do
- if mass2[k].Length >= max then
- max := mass2[k].Length;
- for j := 1 to n do
- begin
- if pos(mass1[i][j], chr) > 0 then
- nom1 := j
- else
- begin
- inc(k2);
- if k2 = max then
- Insert('1', mass1[i], j - 1);}
- end;
- nom1:=0;
- nom2:=0;
- for i:=1 to k1 do
- for j := 1 to Length(mass1[i]) do
- begin
- if (pos(mass1[i][j], chr) =0) or (j=Length(mass1[i])) then
- begin
- if j-nom2<>j-1 then
- nom2:=j;
- writeln(nom1,' ',nom2,'Длина слова ',nom2-nom1,'Длина максимального слова ',mass2[i].Length);
- if nom2-nom1=mass2[i].Length then
- Insert('1',mass1[i],nom2);
- nom1:=0;
- nom2:=0;
- end
- else
- begin
- if nom1 = 0 then
- nom1 := j;
- end
- end;
- end;
- begin
- writeln('Задание №1');
- repeat
- writeln('Введите количество строк: ');
- readln(check);
- until (integer.TryParse(check, k1)) and (k1 <= lmax) and (k1 > 0);
- writeln('Введите ', k1, ' строк: ');
- for i := 1 to k1 do
- readln(mass1[i]);
- task1(mass1, k1);
- for i := 1 to k1 do
- writeln(mass1[i]);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement