You are viewing a single comment's thread. Return to all comments →
from itertools import permutations from re import sub
s, k = input().split() k = int(k)
res = sorted(permutations(s, k))
for p in res: word = "".join(p) print(sub(r'[^a-zA-Z0-9]', ' ', word))
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 from re import sub
s, k = input().split() k = int(k)
res = sorted(permutations(s, k))
for p in res: word = "".join(p) print(sub(r'[^a-zA-Z0-9]', ' ', word))