program Project2;

var f, g:text;
    c:char;
    cb:char;
    nb:integer;

begin
    assign(f, 'input.txt');
    reset(f);
    assign(g, 'output.txt');
    rewrite(g);
    cb:=#0;
    nb:=0;
    while not eof(f) do begin
      read(f, c);
      if c=cb then
        inc(nb)
      else begin
        if nb<>0 then write(g, nb, cb);
        nb:=1;
        cb:=c;
      end;
    end;
    if nb<>0 then write(g, nb, cb);
    close(f);
    close(g);
end.
 