Answer the question
In order to leave comments, you need to log in
How to make the program work without copy, i.e. without procedures and functions in pascal abc.net?
Hello. Need help with a task. Given text. Delete all words that start with the same letter.
How to make the program work without copy, i.e. without procedures and functions in pascal abc?
Here is the source code:
Program p1;
const
C = [' ', ',', '.'];
var
s,max_word: string;
i,k, prev: integer;
step: boolean;
begin
Write('Введите строку s=');
Read(s);
s:=s + ' ';
prev:=0;
for step:=false to true do
for i:=1 to length(s) do
begin
if s[i] in C then
begin
if i-prev>1 then
begin
if not step then
begin
if i - prev - 1 > length(max_word) then
max_word := copy(s, prev + 1, i - prev - 1);
end
else
if s[i - 1] = max_word[length(max_word)] then
write(copy(s, prev + 1, i - prev - 1), ' ');
end;
prev := i;
end;
end;
writeln;
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question