type TFile = file of char;
var f: TFile; ch: char; cnt, i: integer; str: string;
begin
cnt := 0;
AssignFile(f, '111');
Rewrite(f);
writeln('Введите латинские буквы ');
for i := 1 to 5 do
begin
readln(ch);
write(f, ch);
end;
CloseFile(f);
Reset(f);
while not eof(f) do
begin
read(f, ch);
if (ch = 'p') or (ch = 'р') then inc(cnt) // сначала р латинская потом русская
end;
CloseFile(f);
writeln;
writeln('Букв р в файле: ', cnt);
readln;
readln
end.