uses
  Math, SysUtils;
const
  MaxS = 40;
var
  s: String;
  f: TextFile;

  function LongestRun(p: Integer): Integer;
  var
    j: Integer;
  begin
    Result := 1;
    j := p + 1;
    while j <= Length(s) - p + 1 do begin
      if StrLComp(@s[1], @s[j], p) <> 0 then exit;
      Inc(Result);
      Inc(j, p);
    end;
  end;

  function Improvement(len, cnt: Integer): Integer;
  begin
    Result := len * cnt - len - Length(IntToStr(cnt));
  end;

var
  i, bi, c, bc, i1, i2: Integer;
  r: String;
begin
  Assign(f, 'input.txt'); Reset(f);
  Readln(f, s);
  CloseFile(f);

  while s <> '' do begin
    bi := 1;
    bc := 1;
    for i := 1 to Min(MaxS, Length(s)) do begin
      c := LongestRun(i);
      i1 := Improvement(i, c);
      i2 := Improvement(bi, bc);
      if i1 > i2 then begin
        bi := i;
        bc := c;
      end;
    end;
    r := r + Copy(s, 1, bi) + IntToStr(bc);
    Delete(s, 1, bi * bc);
  end;

  Assign(f, 'output.txt'); Rewrite(f);
  Writeln(f, r);
  CloseFile(f);
end.
