Pergunta de entrevista da empresa Bititude Technologies

Second qn:- Given a string aaabbcdeeaa You have to get output as a3b2c1d1e2a2