program numbers;

var line,z:string[37];
    i,cnt:longint;

procedure prcedure(a,b: integer);
var hm:integer;
    s:string[37];
begin
    if a=b then begin 
	writeln('hit ',line[a]);
	cnt:=cnt+1; 
	exit; 
    end;
    for hm:=1 to b-a do
    begin
{    writeln('prc ',hm,' ',a,' ',b);}
      s:=copy(line,a,hm);
      writeln(s);
      if length(s)=length(z) then if s<z then 
      begin
          prcedure(a+hm,b);
{	  cnt:=cnt+1;}
      end;
      if length(s)<length(z) then  
      begin
          prcedure(a+hm,b);
	  if a<b then cnt:=cnt+1;
      end;

    end;

end;

function fucktion(s:string;a,b:integer):longint;
var 
    h:string[37];
    x,i:longint;
begin
    h := copy(s,a,b);
    val(h,x,i);
    result := x;
end;

begin
    while true do
    begin
	cnt:=0;
	readln(line);
	if line='#' then break;
	if length(line)<2 then 
	begin
	    writeln('The code ',line,' is invalid.');
	    continue;
	end;
	if line[1]='0' then
	begin
	    writeln('The code ',line,' can represent 1 numbers.');
	    continue;
	end;
	for i:=1 to length(line)-1 do
	begin
	    z := copy(line,length(line)-i+1,i);
	    if z[1]<>'0' then prcedure(1,length(line)-i);
	    writeln(z,' ',cnt);
	end;
    writeln('The code ',line,' can represent ',cnt,' numbers.');
    end;
end.
