Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement