Pregunta de entrevista de Yandex

Write a string compression algorithm like RLE Input: AAABBBCDDDD Output: A4B3CD4