aboutsummaryrefslogtreecommitdiff
path: root/challenge-328/eric-cheung/python/ch-2.py
blob: 346602cc994742691e44b3d312ab5006f3697f2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## strInput = "WeEeekly"  ## Example 1
## strInput = "abBAdD"  ## Example 2
strInput = "abc"  ## Example 3

bProceed = True
strTemp = strInput

while bProceed:
    bFound = False
    arrTemp = list(strTemp)
    for nIndx, charLoop in enumerate(arrTemp):
        if nIndx == 0:
            continue

        if charLoop.lower() == arrTemp[nIndx - 1].lower() and charLoop != arrTemp[nIndx - 1]:
            del arrTemp[nIndx]
            del arrTemp[nIndx - 1]
            bFound = True
            break

    strTemp = "".join(arrTemp)

    if bFound:
        continue

    bProceed = False

print (strTemp)