You are viewing a single comment's thread. Return to all comments →
from itertools import combinations_with_replacement s, n = input().split() s = sorted(s) combs = list(combinations_with_replacement(s,int(n))) combs = ["".join(x) for x in combs] print(*combs, sep='\n')
itertools.combinations_with_replacement()
You are viewing a single comment's thread. Return to all comments →