You are viewing a single comment's thread. Return to all comments →
from itertools import combinations x = input().split(" ") chain = sorted(list(map(str,x[0]))) size = int(x[1])
for i in range(1, size + 1): for r in list(combinations(chain,i)): print("".join(list(r)))
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.combinations()
You are viewing a single comment's thread. Return to all comments →
from itertools import combinations x = input().split(" ") chain = sorted(list(map(str,x[0]))) size = int(x[1])
for i in range(1, size + 1): for r in list(combinations(chain,i)): print("".join(list(r)))