{$O-}

program ProjectB;

uses
  SysUtils;

var
  fin, fout: TextFile;
  ch, ch2: Char;
  count: Word;

begin
  AssignFile(fin, 'input.txt');
  reset(fin);

  AssignFile(fout, 'output.txt');
  rewrite(fout);

  count := 1;

  read(fin, ch);
  while not(eof(fin)) do
    begin
      read(fin, ch2);

      if ch <> ch2
      then
        begin
          write(fout, count, ch);
          ch := ch2;
          count := 1;
        end
      else
        count := count + 1;
    end;

  write(fout, count, ch);

  CloseFile(fin);
  CloseFile(fout);
end.

