Challenge - #31 - itertools.combinations_with_replacement

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

from itertools import combinations_with_replacement

s, k = input().split()
k = int(k)

for i in list(combinations_with_replacement(sorted(s), k)):
    print(''.join(i))

Comments

Popular posts from this blog

Challenge - #48 - Incorrect Regex

Challenge - #43 - Time Delta