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);

  if eof(fin)
  then
    halt(0);

  read(fin, ch);

  count := 1;
  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.

