about summary refs log tree commit diff
path: root/others/153x/035.py
blob: 1a428e75e0acee4d4d233e969069051e654d3251 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python3

from itertools import permutations

with open("PERMUTE.INP") as f:
    l = sorted(set(permutations(f.readline().strip())))

with open("PERMUTE.OUT", "w") as f:
    f.write("{}\n".format(len(l)))
    for i in l:
        f.write("".join(i) + '\n')