You are viewing a single comment's thread. Return to all comments →
from itertools import permutations
A = input().split(" ")
if len(A) == 1: A = (list(permutations(A[0]))) else: A = (list(permutations(A[0], int(A[1]))))
A = sorted(A) for i in A: print("".join(i))
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.permutations()
You are viewing a single comment's thread. Return to all comments →
from itertools import permutations
A = input().split(" ")
if len(A) == 1: A = (list(permutations(A[0]))) else: A = (list(permutations(A[0], int(A[1]))))
A = sorted(A)
for i in A: print("".join(i))