Pregunta de entrevista de Antra

How to make [a,a,b,c,c] into [2cb2c]