Программа:
Pascal:
var
str, st: string;
count, i: integer;
c: char;
begin
write('Введите строку: '); readln(str);
st := str;
str := ' ' + str;
for i := 1 to length(str) - 1 do
if (str[i + 1] <> ' ') and (str[i] = ' ') then inc(count);
writeln('Слов в строке: ', count);
for c := 'A' to 'Z' do
while pos(c, st) > 0 do
delete(st, pos(c, st), 1);
writeln('Заменённая строка: ', st);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Программа:
Pascal:
var
str, st: string;
count, i: integer;
c: char;
begin
write('Введите строку: '); readln(str);
st := str;
str := ' ' + str;
for i := 1 to length(str) - 1 do
if (str[i + 1] <> ' ') and (str[i] = ' ') then inc(count);
writeln('Слов в строке: ', count);
for c := 'A' to 'Z' do
while pos(c, st) > 0 do
delete(st, pos(c, st), 1);
writeln('Заменённая строка: ', st);
end.