Pregunta de entrevista de PayU

Replace adjacent duplicate characters appearing in a String array by single character