Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы / Pascal.1.курс / part 1 / вариант 22 / lab7
.pas program lab7;
uses crt;
var
s,r: string;
i,max,maxi,c: integer;
begin
clrscr;
write('enter the string: ');
readln(s);
s:=s+'a';
for i:=1 to length(s) do begin
case s[i] of
'0'..'9': c:=c+1;
else begin
if c>max then begin max:=c; maxi:=i; end;
c:=0;
end;
end;
end;
r:=copy(s,maxi-max,max);
writeln('substring: ',r,', length ',max);
writeln('press enter to continue');
readln;
end.
uses crt;
var
s,r: string;
i,max,maxi,c: integer;
begin
clrscr;
write('enter the string: ');
readln(s);
s:=s+'a';
for i:=1 to length(s) do begin
case s[i] of
'0'..'9': c:=c+1;
else begin
if c>max then begin max:=c; maxi:=i; end;
c:=0;
end;
end;
end;
r:=copy(s,maxi-max,max);
writeln('substring: ',r,', length ',max);
writeln('press enter to continue');
readln;
end.
Соседние файлы в папке вариант 22