Answer the question
In order to leave comments, you need to log in
How to delete words without typing a letter? And for me, if the last word starts with the same letter, how to fix it in pascal abc?
Hello. Need help with a task: Create a new text containing all the words in the source text that end in the same letter as the maximum length word.
How to delete words without typing a letter? This is the teacher's requirement.
And for me, if the last word begins with the same letter as the rest, it is deleted, but the last letter of this word remains. How to fix it?
Here is the source code:
Program p1;
var
i:integer;
st:string;
s:char;
Begin
writeln('Enter string st:');
readln(st);
write('Enter letter: ');
readln(s);
st:=' '+st;
repeat
i:=pos(' '+s,st);
inc(i);
if i<>1 then
repeat
delete(st,i,1);
until (st[i]=' ')or(i=length(st));
until i=1;
writeln('st=',st);
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