//Pascal
//--------------------------------------------
var
S: string;
i, counts: byte;
begin
counts := 0;
write('Введите S: ');
readln(s);
for i := 1 to length(s) do
if S[i] = '9' then
counts := counts + 1;
writeln('Количество "9" = ', counts);
readln;
end.