You are viewing a single comment's thread. Return to all comments →
from itertools import combinations inp= input().split() S = list(inp[0]) S.sort() k = int(inp[1]) for i in range(k): Possibilities= list(combinations(S, (i+1))) for element in Possibilities: print(''.join(element))
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 →