#54357: PYTHON詳解


410490535@gms.tku.edu.tw (410490535 TKU)


#因數分解
n = int(input())       #輸入一個值
sol = {}
i = 2

while i*i <= n:       #從2開始一個一個找
    while n % i == 0: #找出因數
        sol[i] = sol.get(i, 0) + 1 #字典公式dict.get(i,0):尋找字典key[i]裡面有沒有值,如果沒有就給予初始值0
        n //= i
    i += 1

if n > 1:
    sol[n] = sol.get(n, 0) + 1

ans = []                 #輸出解答字串
for prime in sol:        #逐一挑出字典裡有數值的KEY

    if sol[prime] == 1:  #儲存只有一次方的因數
        ans.append(str(prime))
    else:
        ans.append(f'{prime}^{sol[prime]}') #儲存次方兩次以上的數

multiplication = " * ".join(ans)

print(multiplication)