We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
itertools.combinations_with_replacement()
itertools.combinations_with_replacement()
Sort by
recency
|
528 Discussions
|
Please Login in order to post a comment
from itertools import combinations_with_replacement
s,k=input().split() k=int(k)
s=sorted(s)
for comb in combinations_with_replacement(s,k): print("".join(comb))
from itertools import combinations_with_replacement
string,k = input().split()
[print(*i,sep="") for i in combinations_with_replacement(sorted(string),int(k))]