program cevanumar;
var x:longint;
function mare(x:longint):integer;
var max:integer;
begin
max:=x mod 10;
x:=x div 10;
while x<>0 do
begin
if max<x mod 10 then
max:=x mod 10
else
x:=x div 10;
end;
mare:=max;
end;
function nraparitii(x:longint):integer;
begin
nrparti:=0
while x<>0 do
begin
if x mod 10 =mare(x) then
nrparti:=nrparti+1;
end;
begin
write('x=');
readln(x);
write('cea mai mare cifra=',mare(x));
write(' ')
writeln('nr aparitii=',nraparitii(x));
readln;
end.