{Encyption type 1}
var fi,fo:file of char;
g,o:char;
fid,fod,x:string;
i,j:byte;
begin
write('Input file : ');readln(fid);
write('Output file: ');readln(fod);
assign(fi,fid);reset(fi);
assign(fo,fod);rewrite(fo);
i:=1;
read(fi,g);
o:=g;
while not eof(fi) do
begin
read(fi,g);
{=====}
while g = o do
begin
inc(i);
read(fi,g);
end;
{=====}
if i>2 then
begin
x:=chr(0)+chr(i)+o;
for j:=1 to 3 do write(fo,x[j]);
end
else for j:=1 to i do write(fo,o);
{=====}
i:=1;
o:=g;
end;
write(fo,g);
close(fo);
end.