You are viewing a single comment's thread. Return to all comments →
from itertools import combinations line = list(input().split(" ")) S = str(line[0]) K = int(line[1]) final = list(S) final1 = [] final2 = [] for x in range(1, K+1): comb = list(combinations(S, x)) for i in comb: word = list(i) word.sort() word1 = "".join(word) final1.append(word1) final1.sort() final2 = final2 + final1 final1.clear() for b in final2: print(b)
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 →