We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
itertools.permutations()
itertools.permutations()
Sort by
recency
|
956 Discussions
|
Please Login in order to post a comment
from itertools import permutations
word, n = input().split()
for i in sorted(permutations(word,int(n))): print(''.join(i))
from itertools import permutations word, n = input().split()
for i in sorted(list(permutations(word, int(n)))): print("".join(i))
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))