program ProjectB;

{uses
  SysUtils;}

var
  fin, fout: TextFile;
  ch, ch2: char;
  i: Word;

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

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

  if eof(fin)
  then
    halt(0);

  i:=1;
  read(fin, ch);
  while not(eof(fin)) do
    begin
      read(fin, ch2);

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

  write(fout, i, ch);

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

