Remove more than one consecutive occurrences of pattern characters from modified string .
for ( let i = modifiedString . length - 1 ; i > 0 ; i -- ) if ( modifiedString [ i ] == modifiedString [ i - 1 ] ) modifiedString . splice ( i , 1 ) ;