Challenge - #30 - itertools.combinations()

 # Enter your code here. Read input from STDIN. Print output to STDOUT

from itertools import combinations
s , k = input().split()

k = int(k)

for i in range(1, k+1):
    for j in list(combinations(sorted(s),i)):
        print(''.join(j))

Comments

Popular posts from this blog

Challenge - #48 - Incorrect Regex

Challenge - #43 - Time Delta