Program p13; const n=4; var s:string; i:integer; begin writeln('wwedite stroku'); readln(s); for i:=1 to length(s) do if s[i]>'5' then s[i]:='1'; writeln('s=',s); readln; end.
Var x,a,c,t:integer; begin readln(x); c:=0; t:=1; while x<>0 do begin a:=x mod 10; if a > 5 then a:=1; c:=a*t+c; t:=t*10; x:=x div 10; end; write(c); readln end.
const n=4;
var s:string;
i:integer;
begin
writeln('wwedite stroku');
readln(s);
for i:=1 to length(s) do
if s[i]>'5' then s[i]:='1';
writeln('s=',s);
readln;
end.
begin
readln(x);
c:=0;
t:=1;
while x<>0 do begin
a:=x mod 10;
if a > 5 then
a:=1;
c:=a*t+c;
t:=t*10;
x:=x div 10; end;
write(c);
readln
end.