program a008;
var s,c:array[0..1000] of integer;
i,m,n:longint;
d:boolean;
begin
repeat
readln(m);
i:=2;
repeat
c[i]:=0;
repeat
d:=true;
if m mod i<>0 then d:=false;
if m mod i=0 then begin
s[i]:=i;
m:=m div i;
c[i]:=c[i]+1;
end;
until d=false;
if c[i]<>0 then write(s[i]);
if c[i]>1 then write('^',c[i]);
if (c[i]<>0)and(m<>1) then write(' * ');
i:=i+1;
until i>sqrt(m);
writeln
until eof;
end.
PASCAL的检察半天就找不出原因?~?