itertools.combinations()

  • + 0 comments

    Enter your code here. Read input from STDIN. Print output to STDOUT

    from itertools import product import itertools import sys

    input_data = sys.stdin.read().strip()

    A, B = input_data.split() B = int(B)

    A_sort = ''.join(sorted(A))

    ''''''

    for j in A_sort: print(j)

    for x in range(2, B+1): perm_set = itertools.combinations(A_sort,x) for i in perm_set: print(''.join(i))