Remove more than one consecutive occurrences of pattern characters from modified string .
for i in range ( len ( modifiedString ) - 1 , 0 , - 1 ) : NEW_LINE INDENT if modifiedString [ i ] == modifiedString [ i - 1 ] : NEW_LINE INDENT modifiedString = modifiedString [ : i ] + modifiedString [ i + 1 : ] NEW_LINE DEDENT DEDENT