You are viewing a single comment's thread. Return to all comments →
from itertools import permutations
input1 = input().split() string = input1[0] n = int(input1[1]) perms = sorted([''.join(perm) for perm in permutations(string, n)])
for perm in perms: print(perm)
itertools.permutations()
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 permutations
input1 = input().split() string = input1[0] n = int(input1[1]) perms = sorted([''.join(perm) for perm in permutations(string, n)])
for perm in perms: print(perm)