每次得到分子为1的分母k = m//n + 1

再把下次进入函数的n和m求出来

def fun(n, m):

if n == 1:
    res.append(m)
    return res
if m % n == 0:
    res.append(m // n)
    return res
while n > 1:
    k = m // n + 1
    res.append(k)
    return fun(n * k - m, m * k)

while True:

try:
    n, m = map(int, input().split('/'))
    res = []
    result = fun(n, m)
    print('1/' + '+1/'.join(map(str, result)))
except:
    break