repeated permutation by mitchs

def f(r,n=0):[f(r+' '+d,n+1)for d in'1234'if(str(n)<r[2])*r>d]or print(r[4:])
f(input())

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page