//String Compressor
var
st:ansistring;
temp:char;
counter,i:integer;
first:boolean;
begin
while not eof do begin
readln(st);
counter:=1;
first:=true;
temp:=' ';
while (length(st)>0) do begin
if first then begin
temp:=st[1];
first:=false;
delete(st,1,1);
end else if((st[1] = temp)and(length(st)>0)) then begin
counter := counter + 1;
delete(st,1,1);
end else if((st[1] <> temp)and(length(st)>0)) then begin
if (counter > 2) then begin
write(counter,temp);
end else begin
for i:=1 to counter do write(temp);
end;
counter:=1;
temp:=st[1];
delete(st,1,1);
end;
end;
if (counter > 2) then begin
writeln(counter,temp);
end else begin
for i:=1 to counter do write(temp);
end;
writeln();
end;
end.