uses
  Math, SysUtils;

var
  s: String;
  f: TextFile;
  a: array [0..1000] of record len, repLen, repCnt: Integer; end;

  procedure Sa(i, len1, repLen1, repCnt1: Integer);
  begin
    if (a[i].len > 0) and (len1 >= a[i].len) then exit;
    with a[i] do begin
      len := len1; repLen := repLen1; repCnt := repCnt1;
    end;
  end;

var
  i, j, k, rl, rc: Integer;
  w: array [0..1000] of Integer;
  r: String;
begin
  Assign(f, 'input.txt'); Reset(f);
  Readln(f, s);
  CloseFile(f);

  for i := 0 to High(w) do
    w[i] := Length(IntToStr(i));

  for i := 1 to Length(s) do begin
    Sa(i, i + 1, i, 1);
    for j := 1 to i - 1 do begin
      Sa(i, a[j].len + i - j + 1, i - j, 1);
      
      rl := a[j].repLen;
      rc := a[j].repCnt;
      if (rl = i - j) and (StrLComp(@s[j - rl + 1], @s[j + 1], rl) = 0) then
        Sa(i, a[j].len - w[rc] + w[rc + 1], rl, rc + 1);

      rl := (i - j) div 2;
      if
        (rl * 2 = i - j) and (StrLComp(@s[j + 1], @s[j + rl + 1], rl) = 0)
      then
        Sa(i, a[j].len + w[rl] + rl, rl, 2);

      k := j + 2;
      while (k <= i) and (s[k] = s[j + 1]) do Inc(k);
      if k > i then
        Sa(i, a[j].len + w[i - j] + 1, 1, i - j);
    end;
  end;

  Assign(f, 'output.txt'); Rewrite(f);
  i := Length(s); r := '';
  while i > 0 do begin
    rl := a[i].repLen;
    rc := a[i].repCnt;
    r := Copy(s, i - rl + 1, rl) + IntToStr(rc) + r;
    Dec(i, rl * rc);
  end;
  Write(f, r);
  CloseFile(f);
end.
