program phone; {$APPTYPE CONSOLE} var x:array[1..10] of integer; smax:integer; rez,tel:string; function min(a,b:integer):integer; begin if a4 then f:=1; if f=0 then begin for i:=1 to pos-1 do s[i]:=0; t1:=tel; for i:=1 to pos-1 do begin t:=copy(t1,1,x[i]); if (x[i]=4)and(t[1]=t[3])then s[i]:=2; if (x[i]=4)and(t[2]=t[4])then s[i]:=2; if (x[i]=4)and(t[1]<>t[2])and(t[2]=t[3])and(t[3]=t[4])then s[i]:=3; if (x[i]=4)and(t[1]=t[3])and(t[2]<>t[3])and(t[3]=t[4])then s[i]:=3; if (x[i]=4)and(t[1]=t[2])and(t[2]=t[4])and(t[3]<>t[4])then s[i]:=3; if (x[i]=4)and(t[1]=t[2])and(t[2]=t[3])and(t[3]<>t[4])then s[i]:=3; if (x[i]=4)and(t[1]=t[2])and(t[3]=t[4])and(t[2]<>t[3])then s[i]:=3; if (x[i]=4)and(t[1]=t[3])and(t[2]=t[4])and(t[1]<>t[2])then s[i]:=3; if (x[i]=4)and(t[1]=t[3])and(t[2]=t[4])and(t[1]<>t[2])then s[i]:=4; if (x[i]=4)and(t[1]=t[2])and(t[2]=t[3])and(t[3]=t[4])then s[i]:=5; if (x[i]=3)and(t[1]=t[2]) then s[i]:=2; if (x[i]=3)and (t[2]=t[3])then s[i]:=2; if (x[i]=3)and (t[1]=t[3])then s[i]:=2; if (x[i]=3)and(t[1]=t[2])and(t[2]=t[3])then s[i]:=3; if (x[i]=2)and (t[1]=t[2])then s[i]:=2; delete(t1,1,x[i]); end; ss:=0; for i:=1 to pos-1 do ss:=ss+s[i]; //writeln('s=',ss); //readln; if ss>smax then begin smax:=ss; rez:=''; t:=tel; for i:=1 to pos-2 do begin rez:=rez+copy(t,1,x[i])+'-'; delete(t,1,x[i]); end; rez:=rez+copy(t,1,x[pos-1]); end; end; end else for i:=number downto 2 {1} do begin x[pos] := i; rozbyt(pos+1,i,number-i); end; end; begin assign(input,'phone.dat'); reset(input); readln(tel); close(input); smax:=0; rozbyt(1,4,7); assign(output,'phone.sol'); rewrite(output); writeln(rez); writeln(smax); close(output); end.