You are viewing a single comment's thread. Return to all comments →
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))
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 →
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))