You are viewing a single comment's thread. Return to all comments →
from itertools import combinations_with_replacement as c
n = input().split()
string = n[0]
size = int(n[1])
sorted_string = ''.join(sorted(string))
lst = [''.join(comb) for comb in c(sorted_string, size)]
print(*lst, sep ="\n")
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.combinations_with_replacement()
You are viewing a single comment's thread. Return to all comments →
from itertools import combinations_with_replacement as c
n = input().split()
string = n[0]
size = int(n[1])
sorted_string = ''.join(sorted(string))
lst = [''.join(comb) for comb in c(sorted_string, size)]
print(*lst, sep ="\n")