You are viewing a single comment's thread. Return to all comments →
import itertools #import module line = input().split() #take input in a single line l, num = list(line[0].upper()), int(line[1]) l.sort() #sort in alphabetical order combinations = list(itertools.combinations_with_replacement(l,num)) for items in combinations: print("".join(items), end="\n") #join the items of list
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 →