[Solved] HOW TO REMOVE DUPLICATES IN A ROW IN PYTHON [closed]


To learn more about text processing in Python3 I recommend training on codingame.com.

def removeDuplicates(inp):
output =""
lastCharacter=""
for character in inp:
    output+=character*(character!=lastCharacter)
    lastCharacter=character
return output

inpTest ="AAABBCCDDAA"
print(removeDuplicates(inpTest))

ABCDA

0

solved HOW TO REMOVE DUPLICATES IN A ROW IN PYTHON [closed]