int main()
{
// make prime list
int primeListSize = 10000;
int primeListSizeSqrt = 100;
bool primeList[primeListSize];
bool flipflop = true;
for (int i = 3; i < primeListSize; i++) // init odd with true, even with false, except 2
{
primeList[i] = flipflop;
flipflop = ~flipflop;
}
primeList[2] = true;
for (int i = 3; i < primeListSizeSqrt; i++) // 3~99 as multipiler
for (int j = i*i; j < primeListSize; j += i) // remove all multiple of multipiler
primeList[j] = false;
long int input;
scanf("%ld", &input);
// find answer
bool isFirst = true;
for (int i = 2; i < primeListSize; i++)
{
if (primeList[i] == true) // if this is prime
{
int repeatTimes = 0;
while (input % i == 0)
{
repeatTimes++;
input /= i;
}
if (repeatTimes > 0)
{
if (isFirst == false)
printf(" * ");
else
isFirst = false;
printf("%d", i);
if (repeatTimes > 1)
printf("^%d", repeatTimes);
}
}
}
if (input > 1)
{
if (isFirst == false)
printf(" * ");
printf("%ld", input);
}
return 0;
}