var x, i, K, R, y: integer;
begin
readln(x);
K := 0; R := 9;
y := x mod 10;
while x > 0 do begin
K := K + 1;
if R > x mod 10 then
R := x mod 10;
x := x div 10
end;
R := y - R;
writeln(K); writeln(R)
end.
|
int x, i, K, R, y;
scanf("%d",&x);
K = 0; R = 9;
y = x % 10;
while (x > 0) {
K = K + 1;
if (R > x % 10)
R = x % 10;
x= x / 10;
}
R = y - R;
printf("%d\n",K); printf("%d\n",R);
|