Created
March 16, 2019 07:15
-
-
Save computingfreak/9dac92830ef3618cd4853f855af6cd83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import permutations,combinations | |
string = raw_input() | |
text=string.split(" ")[0] | |
num=int(string.split(" ")[1]) | |
rc = list() | |
words=list(text) | |
words.sort() | |
for j in range(1,num+1): | |
pc = list(combinations(words,j)) | |
#pc = list(permutations(list(text),num)) | |
qc = list() | |
for e in pc: | |
qc.append(''.join(map(str,e))) | |
#qc.sort() | |
for k in qc: | |
rc.append(k) | |
for f in rc: | |
print(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment