program lab;
var
s: string;
n, i: integer;
begin
writeln('Введите текст: ');
readln(s);
n := 0;
for i := 1 to length(s) do
if s[i] = 'K' then
n := n + 1;
writeln('Буква "K" встречается ', n, ' раз.');
n := 0;
for i := 1 to length(s) - 2 do
if s[i] = 'A' then
if s[i + 1] = 'B' then
if s[i + 2] = 'C' then
n := n + 1;
writeln('Буквосочетание "ABC" встречается ', n, ' раз.');
end.