uses crt;
var st, S,s1:string[255];
i,n,k:byte;
begin
clrscr;
write('nhap xau S:'); readln(S);
while (length(S)<=1) or (length(S)>255) do
begin
write('nhap lai xau S thoa man 1<S<=255:');
readln(S);
end;
st:=''; i:=1; n:=length(S);
while i<=n do
begin
k:=0;
while s[i]=s[i+k] do inc(k);
if k<>1 then
begin
str(k,s1);
st:=st+s1+s[i];
end
else st:=st+s[i];
i:=i+k;
end;
write('xau sau khi nen la:', st);
readln;
end.
const
fi='nenxau.inp';
fo='nenxau.out';
var
f:text;
st:string;
d:integer;
i:byte ;
procedure inp;
begin
assign(f,fi);
reset(F);
read(F,st);
close(F);
end;
procedure out;
begin
assign(f,fo);
rewrite(F);
d:=1;
for i:=1 to length(st) do
begin
if st[i]=st[i+1] then
inc(d)
else
begin
if d>1 then write (f,d,st[i-1]);
if d=1 then write (f,st[i]);
d:=1;
end;
end;
close(F);
end;
BEGIN
INP;
OUT;
END.