If current character S [ i ] is different from S [ j ]
if ( S [ j ] != S [ i ] ) : NEW_LINE INDENT j += 1 NEW_LINE S [ j ] = S [ i ] NEW_LINE DEDENT j += 1 NEW_LINE S = S [ : j ] NEW_LINE return S NEW_LINE