I want to replace repeated instances of the \"*\" character within a string with a single instance of \"*\". For example if the string is \"*
\"*\"
\"*
text = "aaaaaaaaaabbbbbbbbbbcccccccffffdffffdaaaaaa"
result = " "
for char in text:
if len(result) > 0 and result[-1] == char: continue else: result += char
print(result) # abcda