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