program B;
var i,j,a1,a2,n:integer;
m1,m2:array [1..1001] of integer;
inp,out:text; c:char; s,s1,s2,s3:string;
begin
   s1:='';  j:=1;                writeln;
assign(inp,'input.txt'); reset(inp);
assign(out,'output.txt'); rewrite(out);
while not eoln(inp) do begin
readln(inp,s);
end; writeln('na4alo');
val(s[1],a2,n); writeln(s);
for i:=1 to length(s) do begin
val(s[i],m1[i+1],n);
if m1[i+1]=m1[i] then m2[i+1]:=m2[i]+1;
writeln(m2[i+1]);
end; writeln(s);
for i:=1 to length(s) do begin
m2[i+1]:=m2[i+1]+1;  m1[i]:=m1[i+1];  writeln(m2[i+1],' ',m1[i]);
end;
writeln('osnova');
for i:=1 to length(s) do
m2[i]:=m2[i+1];
   for i:=1 to length(s) do begin
   s1:=''; s3:='';
   str(m1[i],s1);  str(m2[i],s3);
   writeln(s3,' ',s1);
   if m2[i+1]<=m2[i] then s2:=s2+s3+s1;
   end;
   writeln(s2);
write(out,s2);
close(inp);
close(out);
end.