You are viewing a single comment's thread. Return to all comments →
from itertools import combinations, chain string, size = input().split() size = int(size) sorted_string = sorted(string) print( "\n".join( "".join(combination) for combination in chain.from_iterable( combinations(sorted_string, r) for r in range(1, size + 1) ) ) )
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.combinations()
You are viewing a single comment's thread. Return to all comments →