You are viewing a single comment's thread. Return to all comments →
from itertools import combinations
s,n = input().split() s = sorted(s) n = int(n)
for i in range(1,n+1): result = sorted(list(combinations(s,i))) for j in result: print(''.join(j))
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
s,n = input().split() s = sorted(s) n = int(n)
for i in range(1,n+1): result = sorted(list(combinations(s,i))) for j in result: print(''.join(j))