aboutsummaryrefslogtreecommitdiff
path: root/challenge-260/eric-cheung/python/ch-2.py
blob: 17f5aa40036b8de181f62cc0549f9faf6ef07c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from itertools import permutations

strWord = "CAT"  ## Example 1
## strWord = "GOOGLE"  ## Example 2
## strWord = "SECRET"  ## Example 3

arrPermList = permutations(list(strWord))

arrPermStrList = sorted(list(set(["".join(arrLoop) for arrLoop in list(arrPermList)])))

print (arrPermStrList.index(strWord) + 1)