aboutsummaryrefslogtreecommitdiff
path: root/challenge-247/eric-cheung/python/ch-2.py
blob: 61a6df372432e41c803781867c13611175bebcf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
## strInput = "abcdbca"  ## Example 1
strInput = "cdeabeabfcdfabgcd"  ## Example 2

arrPairStr = [strInput[nIndxLoop : nIndxLoop + 2] for nIndxLoop in range(len(strInput) - 1)]

arrUniqPair = list(set(arrPairStr))
arrCountPair = [arrPairStr.count(strLoop) for strLoop in arrUniqPair]

arrMaxPair = sorted([arrUniqPair[nIndx] for nIndx in range(len(arrCountPair)) if arrCountPair[nIndx] == max(arrCountPair)])

print (arrMaxPair[0])